Created
August 1, 2022 23:34
-
-
Save jmeggitt/6e258fbf5cda86b19865097bb9e23ff0 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import cProfile, pstats | |
from pstats import SortKey | |
pr = cProfile.Profile() | |
pr.enable() | |
def end_profile(log_file): | |
pr.disable() | |
with open(log_file, "w") as profile_out: | |
profile_stats = pstats.Stats(pr, stream=profile_out).sort_stats(SortKey.CUMULATIVE) | |
profile_stats.print_stats() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment