Commits

matt chisholm  committed 047212f Draft

poor man's profiler

  • Participants
  • Parent commits 0b8870b
  • Branches default

Comments (0)

Files changed (1)

+from test import basic_tests
+
+class profiler(basic_tests):
+    def __init__(self):
+        self.setup()
+        for f in dir(self):
+            if f.startswith('test_'):
+                getattr(self, f)()
+
+    def _helper(self, source, output):
+        self.parser.parse(source)
+
+if __name__ == '__main__':
+    import cProfile, pstats
+    cProfile.run('profiler()', '/tmp/pottymouth_profile')
+    stats = pstats.Stats('/tmp/pottymouth_profile')
+    stats.strip_dirs().sort_stats('time', 'cum').print_stats(25)