Armin Rigo avatar Armin Rigo committed 99d1123

A target similar to targetgcbench, but where the command-line arguments
give the depths of the trees to create.

Comments (0)

Files changed (2)

pypy/translator/goal/gcbench.py

     t_finish = time.time()
     println("\tBottom up constrution took %f ms" % ((t_finish-t_start)*1000.))
 
-def main():
+def main(depths=range(kMinTreeDepth, kMaxTreeDepth+1, 2)):
     println("Garbage Collector Test")
     println(" Stretching memory with a binary tree of depth %d" % kStretchTreeDepth)
     print_diagnostics()
         i += 1
     print_diagnostics()
 
-    for d in range(kMinTreeDepth, kMaxTreeDepth+1, 2):
+    for d in depths:
         time_construction(d)
 
     if long_lived_tree is None or array[1000] != 1.0/1000:

pypy/translator/goal/targetgcbench2.py

+import os, sys
+from pypy.translator.goal import gcbench
+
+def entry_point(argv):
+    if len(argv) > 1:
+        depths = [int(s) for s in argv[1:]]
+        gcbench.main(depths)
+    else:
+        gcbench.main()
+    return 0
+
+# _____ Define and setup target ___
+
+def target(*args):
+    return entry_point, None
+
+"""
+Why is this a stand-alone target?
+
+The above target specifies None as the argument types list.
+This is a case treated specially in the driver.py . If the list
+of input types is empty, it is meant to be a list of strings,
+actually implementing argv of the executable.
+"""
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.