Renamed XLarge* => Large*
[WebKit-https.git] / PerformanceTests / MallocBench / run-malloc-benchmarks
index 240e13b90686576dc3923c48412abd861cb4bc35..e57a4dbc18a024d0107dba482ab9945110593913 100755 (executable)
@@ -6,31 +6,35 @@ require 'pathname'
 $binDir = "#{File.expand_path(File.dirname(__FILE__))}"
 $productDir = `perl -e 'use lib \"#{$binDir}/../../Tools/Scripts\"; use webkitdirs; print productDir()'`
 
-$benchmarks = [
-    "churn",
+$benchmarks_all = [
+    "message_one",
+    "message_many",
     "churn --parallel",
-    "list_allocate",
     "list_allocate --parallel",
-    "tree_allocate",
     "tree_allocate --parallel",
-    "tree_churn",
     "tree_churn --parallel",
-    "facebook",
     "facebook --parallel",
-    "fragment",
-    "fragment --parallel",
-    "fragment_iterate",
-    "fragment_iterate --parallel",
-    "message_one",
-    "message_many",
-    "medium",
-    "medium --parallel",
-    "big",
-    "big --parallel",
+    "reddit --parallel",
+    "flickr --parallel",
+    "theverge --parallel",
+]
+
+$benchmarks_memory = [
+    "facebook",
+    "reddit",
+    "flickr",
+    "theverge",
+    "nimlang"
+]
+
+$benchmarks_memory_warning = [
+    "reddit_memory_warning --runs 0",
+    "flickr_memory_warning --runs 0",
+    "theverge_memory_warning --runs 0",
 ]
 
+$benchmarks = $benchmarks_all
 $heap = 0
-$measureHeap = false
 
 def usage
        puts "run-malloc-benchmarks [options] <Name:/path/to/dylib> [<Name:/path/to/dylib>]"
@@ -174,18 +178,21 @@ end
 def parseOptions
     GetoptLong.new(
         ['--benchmark', GetoptLong::REQUIRED_ARGUMENT],
+        ['--memory', GetoptLong::NO_ARGUMENT],
+        ['--memory_warning', GetoptLong::NO_ARGUMENT],
         ['--heap', GetoptLong::REQUIRED_ARGUMENT],
-        ['--measure-heap', GetoptLong::NO_ARGUMENT],
         ['--help', GetoptLong::NO_ARGUMENT],
     ).each {
         | opt, arg |
         case opt
         when '--benchmark'
             $benchmarks = [ arg ]
+        when '--memory'
+            $benchmarks = $benchmarks_memory
+        when '--memory_warning'
+            $benchmarks = $benchmarks_memory_warning
         when '--heap'
             $heap = arg
-        when '--measure-heap'
-            $measureHeap = true
         when '--help'
             usage
             exit 1
@@ -243,18 +250,18 @@ def runBenchmarks(dylibs)
         dylibs.each {
             | dylib |
 
-            $stderr.print "\rRUNNING #{dylib.name}: #{benchmark}...                "
+            $stderr.print "\rRUNNING #{dylib.name}: #{benchmark}...                                "
             env = "DYLD_LIBRARY_PATH='#{Pathname.new(dylib.path).dirname}' "
             if dylib.name == "NanoMalloc"
                 env += "MallocNanoZone=1 "
             end
-            input = "cd '#{$productDir}'; #{env} '#{$productDir}/MallocBench' --benchmark #{benchmark} --heap #{$heap} #{$measureHeap ? '--measure-heap' : ''}"
+            input = "cd '#{$productDir}'; #{env} '#{$productDir}/MallocBench' --benchmark #{benchmark} --heap #{$heap}}"
             output =`#{input}`
             splitOutput = output.split("\n")
 
             executionTime[-1].push(TimeStat.new(benchmark, splitOutput[1]))
-            peakMemory[-1].push(PeakMemoryStat.new(benchmark, splitOutput.length > 3 ? splitOutput[3] : "0"))
-            memoryAtEnd[-1].push(MemoryStat.new(benchmark, splitOutput.length > 2 ? splitOutput[2] : "0"))
+            peakMemory[-1].push(PeakMemoryStat.new(benchmark, splitOutput.length > 3 ? splitOutput[2] : "0"))
+            memoryAtEnd[-1].push(MemoryStat.new(benchmark, splitOutput.length > 2 ? splitOutput[3] : "0"))
         }
     }
     $stderr.print "\r                                                                                \n"
@@ -267,9 +274,9 @@ def printResults(dylibs, results)
         print
         print lpad("", fieldSize)
         print lpad(dylibs[0].name, fieldSize)
-        if dylibs[1]
+        if dylibs.length > 1
             print lpad(dylibs[1].name, fieldSize)
-            print lpad("Δ", fieldSize * 1.25)
+            print lpad("Δ", fieldSize)
         end
         print "\n"
     end
@@ -285,7 +292,7 @@ def printResults(dylibs, results)
             if results[0][1]
                 means.push(meanFunction.call(results.collect { | stats | stats[1].result }))
                 print lpad("#{prettify(means[1].round, suffix)}", fieldSize)
-                print lpad(compareFunction.call(means[0], means[1]), fieldSize * 1.25)
+                print lpad(compareFunction.call(means[0], means[1]), fieldSize)
             end
 
             print "\n"
@@ -304,7 +311,7 @@ def printResults(dylibs, results)
 
             if stats[1]
                 print lpad("#{prettify(stats[1].result, suffix)}", fieldSize)
-                print lpad(compareFunction.call(stats[0].result, stats[1].result), fieldSize * 1.25)
+                print lpad(compareFunction.call(stats[0].result, stats[1].result), fieldSize)
             end
 
             print "\n"