diff options
author | Mike Bayer <mike_mp@zzzcomputing.com> | 2015-03-09 15:19:49 -0400 |
---|---|---|
committer | Mike Bayer <mike_mp@zzzcomputing.com> | 2015-03-09 15:19:49 -0400 |
commit | 611d88d234319b730b521734418ff7e9aafb1716 (patch) | |
tree | 1aee7663f916308bfad35cccefc78f8cee4dc26b | |
parent | 9afe585f4599d8114abe8d11f924c206a8962cda (diff) | |
download | sqlalchemy-611d88d234319b730b521734418ff7e9aafb1716.tar.gz |
- add a callers option
-rw-r--r-- | examples/performance/__init__.py | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/examples/performance/__init__.py b/examples/performance/__init__.py index 15dbe60ab..88ae9b7dc 100644 --- a/examples/performance/__init__.py +++ b/examples/performance/__init__.py @@ -241,6 +241,7 @@ class Profiler(object): self.runsnake = options.runsnake self.profile = options.profile self.dump = options.dump + self.callers = options.callers self.num = options.num self.echo = options.echo self.stats = [] @@ -298,7 +299,6 @@ class Profiler(object): pr.disable() stats = pstats.Stats(pr).sort_stats('cumulative') - # stats.print_callers() self.stats.append(TestResult(self, fn, stats=stats)) return result @@ -356,6 +356,9 @@ class Profiler(object): '--dump', action='store_true', help='dump full call profile (implies --profile)') parser.add_argument( + '--callers', action='store_true', + help='print callers as well (implies --dump)') + parser.add_argument( '--runsnake', action='store_true', help='invoke runsnakerun (implies --profile)') parser.add_argument( @@ -363,6 +366,7 @@ class Profiler(object): help="Echo SQL output") args = parser.parse_args() + args.dump = args.dump or args.callers args.profile = args.profile or args.dump or args.runsnake if cls.name is None: @@ -410,6 +414,8 @@ class TestResult(object): def _dump(self): self.stats.sort_stats('time', 'calls') self.stats.print_stats() + if self.profile.callers: + self.stats.print_callers() def _runsnake(self): filename = "%s.profile" % self.test.__name__ |