Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
UW-Glance
Manage
Activity
Members
Labels
Plan
Issues
28
Issue boards
Milestones
Wiki
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Eva Schiffer
UW-Glance
Commits
5d4eb6ae
Commit
5d4eb6ae
authored
3 years ago
by
Eva Schiffer
Browse files
Options
Downloads
Patches
Plain Diff
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
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
pyglance/glance/glance_time_profile.py
+29
-0
29 additions, 0 deletions
pyglance/glance/glance_time_profile.py
with
29 additions
and
0 deletions
pyglance/glance/glance_time_profile.py
0 → 100644
+
29
−
0
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
)
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment