[PATCH] D68221: [LNT] Python 3 support: stable profile getFunctions output

Thomas Preud'homme via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sun Oct 6 11:32:34 PDT 2019


This revision was automatically updated to reflect the committed changes.
Closed by commit rL373860: [LNT] Python 3 support: stable profile getFunctions output (authored by thopre, committed by ).
Herald added a project: LLVM.

Repository:
  rL LLVM

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D68221/new/

https://reviews.llvm.org/D68221

Files:
  lnt/trunk/lnt/lnttool/main.py
  lnt/trunk/tests/lnttool/Profile.py


Index: lnt/trunk/tests/lnttool/Profile.py
===================================================================
--- lnt/trunk/tests/lnttool/Profile.py
+++ lnt/trunk/tests/lnttool/Profile.py
@@ -4,8 +4,8 @@
 # RUN: lnt profile getTopLevelCounters %S/Inputs/test.lntprof | FileCheck --check-prefix=CHECK-GETTLC %s
 # CHECK-GETTLC: {"cycles": 12345.0, "branch-misses": 200.0}
 
-# RUN: lnt profile getFunctions %S/Inputs/test.lntprof | FileCheck --check-prefix=CHECK-GETFUNCTIONS %s
-# CHECK-GETFUNCTIONS: {"fn1": {"length": 2, "counters": {"cycles": 45.0, "branch-misses": 10.0}}}
+# RUN: lnt profile getFunctions --sortkeys %S/Inputs/test.lntprof | FileCheck --check-prefix=CHECK-GETFUNCTIONS %s
+# CHECK-GETFUNCTIONS: {"fn1": {"counters": {"branch-misses": 10.0, "cycles": 45.0}, "length": 2}}
 
 # RUN: lnt profile getCodeForFunction %S/Inputs/test.lntprof fn1 | FileCheck --check-prefix=CHECK-GETFN1 %s
 # CHECK-GETFN1: [{}, 1048576, "add r0, r0, r0"], [{"cycles": 100.0}, 1048580, "sub r1, r0, r0"]]
Index: lnt/trunk/lnt/lnttool/main.py
===================================================================
--- lnt/trunk/lnt/lnttool/main.py
+++ lnt/trunk/lnt/lnttool/main.py
@@ -424,11 +424,13 @@
 
 @action_profile.command("getFunctions")
 @click.argument("input", type=click.Path(exists=True))
-def command_get_functions(input):
+ at click.option("--sortkeys", is_flag=True)
+def command_get_functions(input, sortkeys):
     """print the functions in a profile"""
     import json
     import lnt.testing.profile.profile as profile
-    print(json.dumps(profile.Profile.fromFile(input).getFunctions()))
+    print(json.dumps(profile.Profile.fromFile(input).getFunctions(),
+                     sort_keys=sortkeys))
 
 
 @action_profile.command("getCodeForFunction")


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D68221.223432.patch
Type: text/x-patch
Size: 1765 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20191006/f84ec8bd/attachment.bin>


More information about the llvm-commits mailing list