Skip to content
Snippets Groups Projects
Commit 5d4eb6ae authored by Eva Schiffer's avatar Eva Schiffer
Browse files

putting a time profiling module in the code for testing purposes

parent e7b1e0a1
No related branches found
No related tags found
No related merge requests found
#!/usr/bin/env python
"""
This wrapper module is used to profile time spent in different parts of Glance's code.
The only people who should be using this wrapper are developers working on Glance.
To use it, call the module using the syntax that you would call Glance with on the command line.
For example:
python /pathToGitRepository/uwglance/pyglance/glance/glance_time_profile.py report A.nc B.nc
Once the inner Glance command has run, this wrapper will print the top 100 places in code
where the run spent it's time, sorted with the most time consuming first. This should hopefully
give you a rough picture of which calculations are slowing Glance down.
Created by evas March 2022.
Copyright (c) 2022 University of Wisconsin SSEC. All rights reserved.
"""
import glance.compare
import cProfile
import pstats
cProfile.run('glance.compare.main()','statsinfo')
print('\n\n\nShowing resulting stats:\n')
p = pstats.Stats('statsinfo')
# sort by the ones that took the most total time, and only print the top 100
p.strip_dirs().sort_stats('time').print_stats(100)
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment