[pypy-commit] pypy default: call register_code to profile functions, cleanup

mattip pypy.commits at gmail.com
Mon Nov 20 10:11:17 EST 2017


Author: Matti Picus <matti.picus at gmail.com>
Branch: 
Changeset: r93097:d632e9ca79ae
Date: 2017-11-20 17:09 +0200
http://bitbucket.org/pypy/pypy/changeset/d632e9ca79ae/

Log:	call register_code to profile functions, cleanup

diff --git a/rpython/rlib/rvmprof/test/test_rvmprof.py b/rpython/rlib/rvmprof/test/test_rvmprof.py
--- a/rpython/rlib/rvmprof/test/test_rvmprof.py
+++ b/rpython/rlib/rvmprof/test/test_rvmprof.py
@@ -164,23 +164,25 @@
 
     @rvmprof.vmprof_execute_code("xcode1", lambda self, code, count: code)
     def main(self, code, count):
+        code = self.MyCode('py:main:3:main')
+        rvmprof.register_code(code, self.MyCode.get_name)
+        code = self.MyCode('py:code:7:native_func')
+        rvmprof.register_code(code, self.MyCode.get_name)
         if count > 0:
             return self.main(code, count-1)
         else:
             return self.native_func(100)
 
     def test(self):
-        # XXX: this test is known to fail since rev a4f077ba651c, but buildbot
-        # never ran it. FIXME.
         from vmprof import read_profile
-        from vmprof.show import PrettyPrinter
+        # from vmprof.show import PrettyPrinter
         assert self.rpy_entry_point(3, 0.5) == 42000
         assert self.tmpfile.check()
-        #
+
         prof = read_profile(self.tmpfilename)
         tree = prof.get_tree()
-        p = PrettyPrinter()
-        p._print_tree(tree)
+        # p = PrettyPrinter()
+        # p._print_tree(tree)
         def walk(tree, symbols):
             symbols.append(tree.name)
             if len(tree.children) == 0:
@@ -189,7 +191,7 @@
                 walk(child, symbols)
         symbols = []
         walk(tree, symbols)
-        not_found = ['n:native_func']
+        not_found = ['py:code:7:native_func']
         for sym in symbols:
             for i,name in enumerate(not_found):
                 if sym.startswith(name):


More information about the pypy-commit mailing list