Profile using yappi but exclude startup

[skip ci]
This commit is contained in:
Safihre
2023-09-20 10:35:43 +02:00
parent d71f4eb802
commit 65b0991758

View File

@@ -14,7 +14,9 @@
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
import yappi
yappi.set_clock_type("cpu")
import sys
# Trick to show a better message on older Python
@@ -1536,7 +1538,7 @@ def main():
"SABnzbd %s" % sabnzbd.__version__,
ssdp_broadcast_interval=sabnzbd.cfg.ssdp_broadcast_interval(),
)
yappi.start(builtins=True)
# Have to keep this running, otherwise logging will terminate
timer = 0
while not sabnzbd.SABSTOP:
@@ -1612,6 +1614,9 @@ def main():
# CherryPy has special logic to include interpreter options such as "-OO"
cherrypy.engine._do_execv()
stats = yappi.get_func_stats()
stats.save("../test.pstat", type="pstat")
# Send our final goodbyes!
notifier.send_notification("SABnzbd", T("SABnzbd shutdown finished"), "startup")
logging.info("Leaving SABnzbd")