Update profiling script

This commit is contained in:
Damien Elmes 2023-09-14 08:44:38 +10:00
parent 850043b49b
commit 364c32fa79
3 changed files with 6 additions and 16 deletions

View File

@ -493,11 +493,8 @@ PROFILE_CODE = os.environ.get("ANKI_PROFILE_CODE")
def write_profile_results() -> None:
profiler.disable()
profile = os.path.join(os.environ.get("BUILD_WORKSPACE_DIRECTORY", ""), "anki.prof")
profile = "out/anki.prof"
profiler.dump_stats(profile)
profiler.dump_stats("anki.prof")
print("profile stats written to anki.prof")
print("use 'bazel run qt:profile' to explore")
def run() -> None:

View File

@ -1,12 +0,0 @@
# Copyright: Ankitects Pty Ltd and contributors
# License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
import os
import sys
import snakeviz
from snakeviz.cli import main
profile = os.path.join(os.environ["BUILD_WORKSPACE_DIRECTORY"], "anki.prof")
sys.argv.append(profile)
sys.exit(main())

5
tools/profile Executable file
View File

@ -0,0 +1,5 @@
#!/bin/bash
ANKI_PROFILE_CODE=1 ./run
out/pyenv/bin/pip install snakeviz
out/pyenv/bin/snakeviz out/anki.prof