Changeset 155383 in webkit
- Timestamp:
- Sep 9, 2013, 2:36:54 PM (13 years ago)
- Location:
- trunk
- Files:
-
- 3 added
- 4 edited
-
PerformanceTests/SunSpider/ChangeLog (modified) (1 diff)
-
PerformanceTests/SunSpider/profiler-test.yaml (added)
-
Tools/ChangeLog (modified) (1 diff)
-
Tools/Scripts/jsc-stress-test-helpers (added)
-
Tools/Scripts/jsc-stress-test-helpers/profiler-test-helper (added)
-
Tools/Scripts/run-javascriptcore-tests (modified) (1 diff)
-
Tools/Scripts/run-jsc-stress-tests (modified) (12 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/PerformanceTests/SunSpider/ChangeLog
r153824 r155383 1 2013-09-09 Filip Pizlo <fpizlo@apple.com> 2 3 Stress tests should test the jsc profiler (-p) 4 https://bugs.webkit.org/show_bug.cgi?id=121043 5 6 Reviewed by Mark Hahnenberg. 7 8 Add a jsc-stress-test that tries to profile SunSpider. 9 10 * profiler-test.yaml: Added. 11 1 12 2013-08-08 Cosmin Truta <ctruta@blackberry.com> 2 13 -
trunk/Tools/ChangeLog
r155373 r155383 1 2013-09-09 Filip Pizlo <fpizlo@apple.com> 2 3 Stress tests should test the jsc profiler (-p) 4 https://bugs.webkit.org/show_bug.cgi?id=121043 5 6 Reviewed by Mark Hahnenberg. 7 8 Add a runProfiler command that all tests could use. This requires profiler-test-helper, 9 which first runs the JS test and then tries the output with display-profiler-output. 10 But if any of the things required for this to work aren't present, we just do a simpler 11 test that just uses "-p". 12 13 Because I didn't want to pollute SunSpider with "//@ runProfiler", I added the ability 14 to create test collections using a yaml file that specifies the test path and the 15 command to run. 16 17 * Scripts/jsc-stress-test-helpers: Added. 18 * Scripts/jsc-stress-test-helpers/profiler-test-helper: Added. 19 * Scripts/run-javascriptcore-tests: 20 * Scripts/run-jsc-stress-tests: 21 1 22 2013-09-09 Zan Dobersek <zdobersek@igalia.com> 2 23 -
trunk/Tools/Scripts/run-javascriptcore-tests
r155266 r155383 244 244 "PerformanceTests/SunSpider/tests/sunspider-1.0", 245 245 "PerformanceTests/SunSpider/tests/v8-v6", 246 "LayoutTests/fast/js/regress/script-tests" 246 "LayoutTests/fast/js/regress/script-tests", 247 "PerformanceTests/SunSpider/profiler-test.yaml" 247 248 ); 248 249 if ($enableFTL) { -
trunk/Tools/Scripts/run-jsc-stress-tests
r155314 r155383 26 26 require 'getoptlong' 27 27 require 'pathname' 28 require 'yaml' 29 30 THIS_SCRIPT_PATH = Pathname.new(__FILE__).realpath 31 SCRIPTS_PATH = THIS_SCRIPT_PATH.dirname 32 raise unless SCRIPTS_PATH.basename.to_s == "Scripts" 33 raise unless SCRIPTS_PATH.dirname.basename.to_s == "Tools" 34 35 HELPERS_PATH = SCRIPTS_PATH + "jsc-stress-test-helpers" 28 36 29 37 $haveShellwords = false … … 37 45 end 38 46 39 def mysys(*cmd) 47 $canRunDisplayProfilerOutput = false 48 49 begin 50 require 'json' 51 require 'highline' 52 $canRunDisplayProfilerOutput = true 53 rescue => e 54 $stderr.puts "Warning: did not find json or highline; some features will be disabled." 55 $stderr.puts "Error: #{e.inspect}" 56 end 57 58 def printCommandArray(*cmd) 40 59 begin 41 60 commandArray = cmd.each{|value| Shellwords.shellescape(value.to_s)}.join(' ') … … 44 63 end 45 64 $stderr.puts ">> #{commandArray}" 65 end 66 67 def mysys(*cmd) 68 printCommandArray(*cmd) 46 69 raise "Command failed: #{$?.inspect}" unless system(*cmd) 47 70 end … … 54 77 $outputDir = Pathname.new("results") 55 78 $parallel = ($haveShellwords and numProcessors > 1) 79 $verbosity = 0 56 80 57 81 def usage … … 62 86 puts "--[no-]parallel Run in parallel, or not. Default is #{$parallel}." 63 87 puts "--output-dir (-o) Path where to put results. Default is #{$outputDir}." 88 puts "--verbose (-v) Print more things while running." 64 89 puts "--help (-h) Print this message." 65 90 exit 1 … … 71 96 ['--parallel', GetoptLong::NO_ARGUMENT], 72 97 ['--no-parallel', GetoptLong::NO_ARGUMENT], 73 ['--output-dir', '-o', GetoptLong::REQUIRED_ARGUMENT]).each { 98 ['--output-dir', '-o', GetoptLong::REQUIRED_ARGUMENT], 99 ['--verbose', '-v', GetoptLong::NO_ARGUMENT]).each { 74 100 | opt, arg | 75 101 case opt … … 86 112 when '--no-parallel' 87 113 $parallel = false 114 when '--verbose' 115 $verbosity += 1 88 116 end 89 117 } … … 114 142 | outp | 115 143 outp.puts "echo Running #{Shellwords.shellescape(@name)}" 116 outp.puts("(cd #{Shellwords.shellescape(@directory.to_s)} && " + 117 @arguments.map{|v| Shellwords.shellescape(v)}.join(' ') + 118 ") || #{failCommand}") 119 } 120 end 144 cmd = ("(cd #{Shellwords.shellescape(@directory.to_s)} && " + 145 @arguments.map{|v| Shellwords.shellescape(v)}.join(' ') + 146 ") || #{failCommand}") 147 if $verbosity >= 1 148 outp.puts "echo #{Shellwords.shellescape(cmd)}" 149 end 150 outp.puts cmd 151 } 152 end 153 end 154 155 $uniqueFilenameCounter = 0 156 def uniqueFilename(extension) 157 payloadDir = $outputDir + "_payload" 158 Dir.mkdir payloadDir unless payloadDir.directory? 159 result = payloadDir.realpath + "temp-#{$uniqueFilenameCounter}#{extension}" 160 $uniqueFilenameCounter += 1 161 result 162 end 163 164 def addRunCommand(kind, command) 165 $runlist << Plan.new($benchmarkDirectory, command, "#{$collectionName}/#{$benchmark}.#{kind}") 121 166 end 122 167 123 168 def run(kind, *options) 124 $runlist << Plan.new($collection, 125 [$jscPath.to_s] + options + [$benchmark], 126 "#{$collectionName}/#{$benchmark}.#{kind}") 169 addRunCommand(kind, [$jscPath.to_s] + options + [$benchmark.to_s]) 127 170 end 128 171 … … 149 192 def runFTLEager 150 193 run("ftl-eager", "--useExperimentalFTL=true", *EAGER_OPTIONS) 194 end 195 196 def runProfiler 197 profilerOutput = uniqueFilename(".json") 198 if $haveShellwords and $canRunDisplayProfilerOutput 199 addRunCommand("profiler", ["ruby", (HELPERS_PATH + "profiler-test-helper").to_s, (SCRIPTS_PATH + "display-profiler-output").to_s, profilerOutput.to_s, $jscPath.to_s, "-p", profilerOutput.to_s, $benchmark.to_s]) 200 else 201 run("profiler-simple", "-p", profilerOutput.to_s) 202 end 151 203 end 152 204 … … 167 219 end 168 220 169 collectionNames = {}170 171 221 Dir.mkdir($outputDir) unless $outputDir.directory? 172 222 begin … … 177 227 $outputDir = $outputDir.realpath 178 228 179 ARGV.each { 180 | collection | 181 $collection = Pathname.new(collection) 182 outerDir = $collection.dirname 183 name = $collection.basename 229 def allJSFiles(path) 230 if path.file? 231 [path] 232 else 233 result = [] 234 Dir.foreach(path) { 235 | filename | 236 next unless filename =~ /\.js$/ 237 next unless (path + filename).file? 238 result << path + filename 239 } 240 result 241 end 242 end 243 244 # Returns [collectionPath, collectionName] 245 def simplifyCollectionName(collectionNames, collectionPath) 246 outerDir = collectionPath.dirname 247 name = collectionPath.basename 184 248 lastName = name 185 while lastName.to_s =~ /test/ 186 lastName = outerDir.basename 187 name = lastName + name 188 outerDir = outerDir.dirname 189 end 190 $collectionName = name.to_s 249 if collectionPath.directory? 250 while lastName.to_s =~ /test/ 251 lastName = outerDir.basename 252 name = lastName + name 253 outerDir = outerDir.dirname 254 end 255 end 256 collectionName = name.to_s 191 257 toAdd = 1 192 while collectionNames[ $collectionName]193 $collectionName = File.basename(name.to_s) + "-#{toAdd}"258 while collectionNames[collectionName] 259 collectionName = File.basename(name.to_s) + "-#{toAdd}" 194 260 toAdd += 1 195 261 end 196 collectionNames[$collectionName] = true 262 collectionNames[collectionName] = true 263 [collectionPath, collectionName] 264 end 265 266 def prepareCollection(name) 197 267 dir = $outputDir 198 name.each_filename {268 Pathname.new(name).each_filename { 199 269 | filename | 200 270 dir = dir + filename 201 271 Dir.mkdir(dir) unless dir.directory? 202 272 } 203 204 Dir.foreach($collection) { 205 | benchmark | 206 next unless benchmark =~ /\.js$/ 207 next unless ($collection + benchmark).file? 273 end 274 275 collectionNames = {} 276 277 ARGV.each { 278 | collection | 279 collection, collectionName = simplifyCollectionName(collectionNames, Pathname.new(collection)) 280 281 if collection.file? 282 subCollectionNames = {} 283 YAML::load(IO::read(collection)).each { 284 | entry | 285 path = collection.dirname + entry["path"] 286 287 subCollection, subCollectionName = simplifyCollectionName(subCollectionNames, path) 288 289 $collection = subCollection 290 $collectionName = (Pathname.new(collectionName) + subCollectionName).to_s 291 292 prepareCollection($collectionName) 293 294 allJSFiles(path).each { 295 | path | 296 297 path = path.realpath 298 299 $benchmark = path.basename 300 $benchmarkDirectory = path.dirname 301 302 eval entry["cmd"] 303 } 304 } 305 else 306 prepareCollection(collectionName) 208 307 209 $benchmark = benchmark 210 211 didRun = false 212 File.open($collection + benchmark) { 213 | inp | 214 inp.each_line { 215 | line | 216 next unless line =~ /^\/\/@/ 217 eval $~.post_match 218 didRun = true 308 $collection = collection 309 $collectionName = collectionName 310 $benchmarkDirectory = $collection 311 allJSFiles($collection).each { 312 | path | 313 314 $benchmark = path.basename 315 316 didRun = false 317 File.open($collection + $benchmark) { 318 | inp | 319 inp.each_line { 320 | line | 321 next unless line =~ /^\/\/@/ 322 eval $~.post_match 323 didRun = true 324 } 219 325 } 220 }221 222 defaultRun unless didRun223 }326 327 defaultRun unless didRun 328 } 329 end 224 330 } 225 331 … … 344 450 345 451 Dir.chdir(plan.directory) { 452 if $verbosity >= 1 453 printCommandArray(*plan.arguments) 454 end 346 455 if system(*plan.arguments) 347 456 puts "OK."
Note:
See TracChangeset
for help on using the changeset viewer.