1
0
mirror of https://github.com/craigerl/aprsd.git synced 2024-11-22 16:08:44 -05:00

Added memory tracing in keeplive

This commit is contained in:
Hemna 2021-01-29 11:02:21 -05:00
parent 0b44fc08eb
commit db2b537317
3 changed files with 10 additions and 4 deletions

View File

@ -51,6 +51,9 @@ def _imap_connect():
server.select_folder("INBOX")
server.fetch = trace.trace(server.fetch)
server.search = trace.trace(server.search)
server.remove_flags = trace.trace(server.remove_flags)
server.add_flags = trace.trace(server.add_flags)
return server
@ -89,6 +92,7 @@ def _smtp_connect():
debug = CONFIG["aprsd"]["email"]["smtp"].get("debug", False)
if debug:
server.set_debuglevel(5)
server.sendmail = trace.trace(server.sendmail)
try:
server.login(

View File

@ -425,10 +425,7 @@ def server(
setup_logging(config, loglevel, quiet)
if config["aprsd"].get("trace", False):
click.echo("PISS")
trace.setup_tracing(["method", "api"])
else:
click.echo("NO PISS")
LOG.info("APRSD Started version: {}".format(aprsd.__version__))
stats.APRSDStats(config)

View File

@ -4,6 +4,7 @@ import logging
import queue
import threading
import time
import tracemalloc
from aprsd import client, messaging, plugin, stats, trace
import aprslib
@ -69,6 +70,7 @@ class KeepAliveThread(APRSDThread):
def __init__(self):
super().__init__("KeepAlive")
tracemalloc.start()
def loop(self):
if self.cntr % 6 == 0:
@ -81,14 +83,17 @@ class KeepAliveThread(APRSDThread):
else:
email_thread_time = "N/A"
current, peak = tracemalloc.get_traced_memory()
LOG.debug(
"Uptime ({}) Tracker({}) "
"Msgs: TX:{} RX:{} EmailThread: {}".format(
"Msgs: TX:{} RX:{} EmailThread: {} RAM: Current:{} Peak:{}".format(
stats_obj.uptime,
len(tracker),
stats_obj.msgs_tx,
stats_obj.msgs_rx,
email_thread_time,
current,
peak,
),
)
self.cntr += 1