[PATCH] D96002: [test-suite][AIX] Enable profiling via hpmcount on AIX

Kai Luo via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Mar 15 02:00:48 PDT 2021


This revision was automatically updated to reflect the committed changes.
Closed by commit rTe4defee7cbb2: [test-suite][AIX] Enable profiling via hpmcount on AIX (authored by lkail).

Repository:
  rT test-suite

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

https://reviews.llvm.org/D96002

Files:
  lit.cfg
  litsupport/modules/hpmcount.py


Index: litsupport/modules/hpmcount.py
===================================================================
--- /dev/null
+++ litsupport/modules/hpmcount.py
@@ -0,0 +1,34 @@
+"""Test Module to perform an extra execution of the benchmark in the AIX
+hpmcount tool."""
+from litsupport import shellcommand
+from litsupport import testplan
+from litsupport.modules import run_under
+
+import os
+
+
+def _mutateCommandLine(context, commandline):
+    context.profilefile = context.tmpBase + ".hpmcount_data"
+    # Storing profile file in context allows other modules to be aware of it.
+    cmd = shellcommand.parse(commandline)
+    cmd.wrap('hpmcount', ['-o', context.profilefile])
+    if cmd.stdout is None:
+        cmd.stdout = os.devnull
+    else:
+        cmd.stdout += ".hpmcount"
+    if cmd.stderr is None:
+        cmd.stderr = os.devnull
+    else:
+        cmd.stderr += ".hpmcount"
+    return cmd.toCommandline()
+
+
+def mutatePlan(context, plan):
+    script = context.parsed_runscript
+    if context.config.run_under:
+        script = testplan.mutateScript(context, script,
+                                       run_under.mutateCommandLine)
+    script = testplan.mutateScript(context, script, _mutateCommandLine)
+    plan.profilescript += script
+    plan.metric_collectors.append(
+        lambda context: {'profile': context.profilefile})
Index: lit.cfg
===================================================================
--- lit.cfg
+++ lit.cfg
@@ -48,3 +48,6 @@
 # Find and initialize lit modules.
 if lit_config.params.get('profile') == 'perf':
     config.test_modules += ['perf']
+
+if lit_config.params.get('profile') == 'hpmcount':
+    config.test_modules += ['hpmcount']


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D96002.330577.patch
Type: text/x-patch
Size: 1704 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210315/3b7175c6/attachment.bin>


More information about the llvm-commits mailing list