[PATCH] D16218: [test-suite] Add --param=profile=perf option to lit.
Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Jan 28 07:34:15 PST 2016
This revision was automatically updated to reflect the committed changes.
Closed by commit rL259051: Add --param=profile=perf option to lit. (authored by kbeyls).
Changed prior to commit:
http://reviews.llvm.org/D16218?vs=44978&id=46273#toc
Repository:
rL LLVM
http://reviews.llvm.org/D16218
Files:
test-suite/trunk/lit.cfg
Index: test-suite/trunk/lit.cfg
===================================================================
--- test-suite/trunk/lit.cfg
+++ test-suite/trunk/lit.cfg
@@ -156,6 +156,25 @@
return new_commandline
+def wrapScriptInRunSafely(config, script, outfile):
+ adjusted_script = []
+ for line in script:
+ line = prepareRunSafely(config, line, outfile)
+ adjusted_script.append(line)
+ return adjusted_script
+
+
+def wrapScriptInPerf(config, runscript, tmpBase):
+ profilefile = tmpBase + ".perf_data"
+ profilescript = []
+ for line in runscript:
+ profilescript.append(
+ ' '.join(
+ ['perf record -e cycles,cache-misses,branch-misses -o',
+ profilefile, line]))
+ return profilescript
+
+
class TestSuiteTest(FileBasedTest):
def __init__(self):
super(TestSuiteTest, self).__init__()
@@ -180,11 +199,12 @@
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':
+ profilescript = wrapScriptInPerf(config, runscript, tmpBase)
+ profilescript = wrapScriptInRunSafely(config, profilescript,
+ outfile=tmpBase+".perf.out")
+
+ runscript = wrapScriptInRunSafely(config, runscript, outfile)
# Create the output directory if it does not already exist.
lit.util.mkdir_p(os.path.dirname(tmpBase))
@@ -214,6 +234,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.46273.patch
Type: text/x-patch
Size: 2154 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20160128/6b5419de/attachment.bin>
More information about the llvm-commits
mailing list