display-profiler-output should be able to display code blocks sorted by machine counts
authorfpizlo@apple.com <fpizlo@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 21 Jan 2016 15:47:31 +0000 (15:47 +0000)
committerfpizlo@apple.com <fpizlo@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 21 Jan 2016 15:47:31 +0000 (15:47 +0000)
https://bugs.webkit.org/show_bug.cgi?id=153298

Reviewed by Oliver Hunt.

* Scripts/display-profiler-output:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@195409 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Tools/ChangeLog
Tools/Scripts/display-profiler-output

index 8142d25..206a167 100644 (file)
@@ -1,3 +1,12 @@
+2016-01-21  Filip Pizlo  <fpizlo@apple.com>
+
+        display-profiler-output should be able to display code blocks sorted by machine counts
+        https://bugs.webkit.org/show_bug.cgi?id=153298
+
+        Reviewed by Oliver Hunt.
+
+        * Scripts/display-profiler-output:
+
 2016-01-21  Julien Isorce  <j.isorce@samsung.com>
 
         Ensure to use compatible liborc version with wanted gstreamer version
index 498e639..50f17bd 100755 (executable)
@@ -535,7 +535,7 @@ def sortByMode(list)
     end
 end
 
-def summary(mode)
+def summary(mode, order)
     remaining = screenWidth
     
     # Figure out how many columns we need for the code block names, and for counts
@@ -618,7 +618,14 @@ def summary(mode)
     puts
     $bytecodes.sort {
         | a, b |
-        b.totalMaxTopExecutionCount <=> a.totalMaxTopExecutionCount
+        case order
+        when :bytecode
+            b.totalMaxTopExecutionCount <=> a.totalMaxTopExecutionCount
+        when :machine
+            b.totalMaxBottomExecutionCount <=> a.totalMaxBottomExecutionCount
+        else
+            raise
+        end
     }.each {
         | bytecode |
         print(center(bytecode.name(hashCols), hashCols))
@@ -738,9 +745,13 @@ def executeCommand(*commandArray)
     when "quit", "q", "exit"
         exit 0
     when "summary", "s"
-        summary(:summary)
+        summary(:summary, :bytecode)
     when "full", "f"
-        summary(:full)
+        if args[0] and (args[0] == "m" or args[0] == "machine")
+            summary(:full, :machine)
+        else
+            summary(:full, :bytecode)
+        end
     when "source"
         if args.length != 1
             puts "Usage: source <code block hash>"