[PATCH] D16218: [test-suite] Add --param=profile=perf option to lit.
Kristof Beyls via llvm-commits
llvm-commits at lists.llvm.org
Fri Jan 15 05:56:20 PST 2016
kristof.beyls created this revision.
kristof.beyls added reviewers: MatzeB, jmolloy, mcrosier.
kristof.beyls added a subscriber: llvm-commits.
This option will also run each test under perf record, and store the
perf data in the Output directory.
At least on my system, there seems to be a limitation on running many
perf profilers in parallel, so for best results it's probably best to
use lit -j1 in combination with this option.
http://reviews.llvm.org/D16218
Files:
lit.cfg
Index: lit.cfg
===================================================================
--- lit.cfg
+++ lit.cfg
@@ -145,6 +145,13 @@
new_commandline = " ".join(map(quote, runsafely_prefix + tokens))
return new_commandline
+def wrapScriptInRunSafely(script, outfile):
+ adjusted_script = []
+ for line in script:
+ line = prepareRunSafely(config, line, outfile)
+ adjusted_script.append(line)
+ return adjusted_script
+
class TestSuiteTest(FileBasedTest):
def __init__(self):
super(TestSuiteTest, self).__init__()
@@ -169,11 +176,19 @@
runscript = applySubstitutions(runscript, substitutions)
verifyscript = applySubstitutions(verifyscript, substitutions)
- adjusted_runscript = []
- for line in runscript:
- line = prepareRunSafely(config, line, outfile)
- adjusted_runscript.append(line)
- runscript = adjusted_runscript
+ if litConfig.params.get('profile') == 'perf':
+ # wrap linux perf command to do profiling
+ profilefile = tmpBase + ".perf_data"
+ profilescript=[]
+ for line in runscript:
+ profilescript.append(
+ ' '.join(
+ ['perf record -e cycles,cache-misses,branch-misses -o',
+ profilefile, line]))
+ profilescript = wrapScriptInRunSafely(profilescript,
+ outfile=tmpBase+".perf.out")
+
+ runscript = wrapScriptInRunSafely(runscript, outfile)
# Create the output directory if it does not already exist.
lit.util.mkdir_p(os.path.dirname(tmpBase))
@@ -203,6 +218,10 @@
except IOError:
pass
+ if litConfig.params.get('profile') == 'perf':
+ res = runScript(test, litConfig, profilescript, tmpBase)
+ out, err, exitCode, timeoutInfo = res
+
# Run verification script (the "VERIFY:" part)
if len(verifyscript) > 0:
res = runScript(test, litConfig, verifyscript, tmpBase)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D16218.44978.patch
Type: text/x-patch
Size: 2101 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20160115/eac39063/attachment.bin>
More information about the llvm-commits
mailing list