summaryrefslogtreecommitdiff
path: root/lib/sqlalchemy/testing/profiling.py
diff options
context:
space:
mode:
authorMike Bayer <mike_mp@zzzcomputing.com>2019-07-14 11:43:29 -0400
committerMike Bayer <mike_mp@zzzcomputing.com>2019-07-14 11:43:29 -0400
commitbe9f433ae38d04a8a52d86df09b760dbbfc6cd3e (patch)
treeb1242b41b148c54eb8193ada133e8a6323694c5a /lib/sqlalchemy/testing/profiling.py
parent116faee662f618d5ecd13b1e074a27d5e5a40564 (diff)
downloadsqlalchemy-be9f433ae38d04a8a52d86df09b760dbbfc6cd3e.tar.gz
Add profile sort option to test suite
I use the nfl sort a lot to see what calling changes are happening between two versions in order to identify the offending code, so add it as a command line option. Change-Id: Ia1ab6dd98012a78298b325bb5c7c050fa9b767c2
Diffstat (limited to 'lib/sqlalchemy/testing/profiling.py')
-rw-r--r--lib/sqlalchemy/testing/profiling.py5
1 files changed, 3 insertions, 2 deletions
diff --git a/lib/sqlalchemy/testing/profiling.py b/lib/sqlalchemy/testing/profiling.py
index a75549027..bfc4997e1 100644
--- a/lib/sqlalchemy/testing/profiling.py
+++ b/lib/sqlalchemy/testing/profiling.py
@@ -65,7 +65,7 @@ class ProfileStatsFile(object):
"""
- def __init__(self, filename):
+ def __init__(self, filename, sort="cumulative"):
self.force_write = (
config.options is not None and config.options.force_write_profiles
)
@@ -77,6 +77,7 @@ class ProfileStatsFile(object):
self.data = collections.defaultdict(
lambda: collections.defaultdict(dict)
)
+ self.sort = sort
self._read()
if self.write:
# rewrite for the case where features changed,
@@ -277,7 +278,7 @@ def count_functions(variance=0.05):
line_no, expected_count = expected
print(("Pstats calls: %d Expected %s" % (callcount, expected_count)))
- stats.sort_stats("cumulative")
+ stats.sort_stats(_profile_stats.sort)
stats.print_stats()
if _profile_stats.force_write: