Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Eva Schiffer
UW-Glance
Commits
5d4eb6ae
Commit
5d4eb6ae
authored
Mar 07, 2022
by
Eva Schiffer
Browse files
putting a time profiling module in the code for testing purposes
parent
e7b1e0a1
Changes
1
Hide whitespace changes
Inline
Side-by-side
pyglance/glance/glance_time_profile.py
0 → 100644
View file @
5d4eb6ae
#!/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\n
Showing 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
)
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment