Title: [131638] trunk/PerformanceTests
- Revision
- 131638
- Author
- [email protected]
- Date
- 2012-10-17 13:57:46 -0700 (Wed, 17 Oct 2012)
Log Message
Performance test should support asynchronous tests
https://bugs.webkit.org/show_bug.cgi?id=95668
Reviewed by Dirk Pranke.
Added PerfTestRunner.prepareToMeasureValuesAsync and PerfTestRunner.measureValueAsync,
and deployed it in Animation/balls.
* Animation/balls.html:
* resources/runner.js:
Modified Paths
Diff
Modified: trunk/PerformanceTests/Animation/balls.html (131637 => 131638)
--- trunk/PerformanceTests/Animation/balls.html 2012-10-17 20:36:31 UTC (rev 131637)
+++ trunk/PerformanceTests/Animation/balls.html 2012-10-17 20:57:46 UTC (rev 131638)
@@ -90,8 +90,6 @@
<script type="text/_javascript_">
var FRAMES_PER_TIMER_READING = 10;
- var MAX_ITERATIONS = 110;
- var MAX_RUNS = 1;
var MAX_PARTICLES = 2500;
var MAX_VELOCITY = 50;
var PARTICLE_RADIUS = 6;
@@ -107,19 +105,9 @@
var frameRates = [];
var particles = [];
- window._onload_ = init;
+ window._onload_ = function () {
+ PerfTestRunner.prepareToMeasureValuesAsync({runCount: 10, done: onCompletedRun, unit: 'fps'});
- function init()
- {
- PerfTestRunner.resetRandomSeed();
-
- var location = window.location.href;
- frameRates = [];
- frameTimes = [];
- iteration = 0;
- animateIntervalId = 0;
- particles = [];
-
// Create the particles
for (var i = 0; i < MAX_PARTICLES; i++)
particles.push(new Particle());
@@ -130,7 +118,7 @@
function animate()
{
- var currTime = new Date().getTime();
+ var currTime = PerfTestRunner.now();
var timeDelta = currTime - frameTimes[frameTimes.length - 1];
if (isNaN(timeDelta))
@@ -151,19 +139,9 @@
var frameRate = document.getElementById("frameRate");
var frameRateVal = FRAMES_PER_TIMER_READING * 1000 / ((currTime - frameTimes[0]) / (frameTimes.length - 1));
- if (!isNaN(frameRateVal)) {
- frameRates.push(frameRateVal);
- var frameRateText = frameRateVal + "";
- frameRateText = frameRateText.replace(/(^[^.]+\...).*/, "$1");
- frameRateText += " fps";
- frameRate.innerHTML = frameRateText;
- }
+ if (!isNaN(frameRateVal))
+ PerfTestRunner.measureValueAync(frameRateVal);
}
-
- if (iteration > MAX_ITERATIONS) {
- clearInterval(animateIntervalId);
- onCompletedRun();
- }
}
function Particle()
@@ -237,6 +215,8 @@
}
function onCompletedRun() {
+ clearInterval(animateIntervalId);
+
for (var particle in particles) {
var p = particles[particle];
particles[particle] = 0;
@@ -245,22 +225,6 @@
particles = [];
frameRate.innerHTML = "";
-
- for (var rate in frameRates)
- PerfTestRunner.log(frameRates[rate].toFixed(2) + " fps");
-
- var stats = PerfTestRunner.computeStatistics(frameRates, "fps");
- statistics.push(stats);
-
- PerfTestRunner.printStatistics(stats, "Time:");
- PerfTestRunner.getAndPrintMemoryStatistics();
-
- if (++run < MAX_RUNS) {
- PerfTestRunner.log("<br>===================================================<br>");
- init();
- }
- else if (window.testRunner)
- testRunner.notifyDone();
}
</script>
<script src=""
Modified: trunk/PerformanceTests/ChangeLog (131637 => 131638)
--- trunk/PerformanceTests/ChangeLog 2012-10-17 20:36:31 UTC (rev 131637)
+++ trunk/PerformanceTests/ChangeLog 2012-10-17 20:57:46 UTC (rev 131638)
@@ -1,3 +1,16 @@
+2012-10-17 Ryosuke Niwa <[email protected]>
+
+ Performance test should support asynchronous tests
+ https://bugs.webkit.org/show_bug.cgi?id=95668
+
+ Reviewed by Dirk Pranke.
+
+ Added PerfTestRunner.prepareToMeasureValuesAsync and PerfTestRunner.measureValueAsync,
+ and deployed it in Animation/balls.
+
+ * Animation/balls.html:
+ * resources/runner.js:
+
2012-10-16 Elliott Sprehn <[email protected]>
html5-full-render.html test uses substring but meant substr
Modified: trunk/PerformanceTests/resources/runner.js (131637 => 131638)
--- trunk/PerformanceTests/resources/runner.js 2012-10-17 20:36:31 UTC (rev 131637)
+++ trunk/PerformanceTests/resources/runner.js 2012-10-17 20:57:46 UTC (rev 131638)
@@ -170,7 +170,8 @@
runCount = test.runCount || 20;
logLines = window.testRunner ? [] : null;
PerfTestRunner.log("Running " + runCount + " times");
- scheduleNextRun(runner);
+ if (runner)
+ scheduleNextRun(runner);
}
function scheduleNextRun(runner) {
@@ -234,6 +235,25 @@
testRunner.notifyDone();
}
+ PerfTestRunner.prepareToMeasureValuesAsync = function (test) {
+ PerfTestRunner.unit = test.unit;
+ start(test);
+ }
+
+ PerfTestRunner.measureValueAync = function (measuredValue) {
+ completedRuns++;
+
+ try {
+ ignoreWarmUpAndLog(measuredValue);
+ } catch (exception) {
+ logFatalError("Got an exception while logging the result with name=" + exception.name + ", message=" + exception.message);
+ return;
+ }
+
+ if (completedRuns >= runCount)
+ finish();
+ }
+
PerfTestRunner.measureTime = function (test) {
PerfTestRunner.unit = "ms";
start(test, measureTimeOnce);
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo/webkit-changes