Commit 63e67135 authored by kmccullough@apple.com's avatar kmccullough@apple.com

2008-10-23 Kevin McCullough <kmccullough@apple.com>

        Reviewed by Tim Hatcher.

        https://bugs.webkit.org/show_bug.cgi?id=21817
        Bug 21817: Manual profiler tests should be made into layout tests

        - Here are the changes to the tests.  The most significant part is the
        change to profiler-test-JS-resources.js where endTest will now notify
        the layout test controller if it was waiting and call the print function
        to iterate over all of the profiles and log their structure.
        - Most of these tests changed to include the layoutTestController, use
        endTest() or call the print function directly if there was some reason
        that they could not use endTest().

        * fast/profiler/resources/profiler-test-JS-resources.js:
        (endTest): Stop any waits and print the profile information.
        (printHeavyProfilesDataWithoutTime): Print all profile information in 
        heavy view, without time.
        (printProfilesDataWithoutTime): Print all profile information in tree
        view, without time.
        (printProfileNodeWithoutTime): Print a profile node's informmation and
        all of it's children's information.
        * fast/profiler/anonymous-event-handler.html:
        * fast/profiler/anonymous-function-called-from-different-contexts.html:
        * fast/profiler/anonymous-function-calls-built-in-functions.html:
        * fast/profiler/anonymous-function-calls-eval.html:
        * fast/profiler/apply.html:
        * fast/profiler/built-in-function-calls-anonymous.html:
        * fast/profiler/built-in-function-calls-user-defined-function.html:
        * fast/profiler/call-nodelist-as-function.html:
        * fast/profiler/calling-the-function-that-started-the-profiler-from-another-scope.html:
        * fast/profiler/compare-multiple-profiles.html:
        * fast/profiler/constructor.html:
        * fast/profiler/dead-time.html:
        * fast/profiler/deep-recursion.html:
        * fast/profiler/document-dot-write.html:
        * fast/profiler/event-handler.html:
        * fast/profiler/execution-context-and-eval-on-same-line.html:
        * fast/profiler/heavy-view.html:
        * fast/profiler/inline-event-handler.html:
        * fast/profiler/multiple-and-different-scoped-anonymous-function-calls.html:
        * fast/profiler/multiple-and-different-scoped-function-calls.html:
        * fast/profiler/multiple-frames.html:
        * fast/profiler/nested-anonymous-functon.html:
        * fast/profiler/nested-start-and-stop-profiler.html:
        * fast/profiler/no-execution-context.html:
        * fast/profiler/one-execution-context.html:
        * fast/profiler/profile-calls-in-included-file.html:
        * fast/profiler/profiling-from-a-nested-location-but-stop-profiling-outside-the-nesting.html:
        * fast/profiler/profiling-from-a-nested-location.html:
        * fast/profiler/simple-event-call.html:
        * fast/profiler/simple-no-level-change.html:
        * fast/profiler/start-and-stop-profiler-multiple-times.html:
        * fast/profiler/start-and-stop-profiling-in-the-same-function.html:
        * fast/profiler/start-but-dont-stop-profiling.html:
        * fast/profiler/stop-profiling-after-setTimeout.html:
        * fast/profiler/stop-then-function-call.html:
        * fast/profiler/throw-exception-from-eval.html:
        * fast/profiler/two-execution-contexts.html:
        * fast/profiler/user-defined-function-calls-built-in-functions.html:
        * fast/profiler/window-dot-eval.html:



git-svn-id: http://svn.webkit.org/repository/webkit/trunk@37822 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent b7074c08
2008-10-23 Kevin McCullough <kmccullough@apple.com>
Reviewed by Tim Hatcher.
https://bugs.webkit.org/show_bug.cgi?id=21817
Bug 21817: Manual profiler tests should be made into layout tests
- Here are the changes to the tests. The most significant part is the
change to profiler-test-JS-resources.js where endTest will now notify
the layout test controller if it was waiting and call the print function
to iterate over all of the profiles and log their structure.
- Most of these tests changed to include the layoutTestController, use
endTest() or call the print function directly if there was some reason
that they could not use endTest().
* fast/profiler/resources/profiler-test-JS-resources.js:
(endTest): Stop any waits and print the profile information.
(printHeavyProfilesDataWithoutTime): Print all profile information in
heavy view, without time.
(printProfilesDataWithoutTime): Print all profile information in tree
view, without time.
(printProfileNodeWithoutTime): Print a profile node's informmation and
all of it's children's information.
* fast/profiler/anonymous-event-handler.html:
* fast/profiler/anonymous-function-called-from-different-contexts.html:
* fast/profiler/anonymous-function-calls-built-in-functions.html:
* fast/profiler/anonymous-function-calls-eval.html:
* fast/profiler/apply.html:
* fast/profiler/built-in-function-calls-anonymous.html:
* fast/profiler/built-in-function-calls-user-defined-function.html:
* fast/profiler/call-nodelist-as-function.html:
* fast/profiler/calling-the-function-that-started-the-profiler-from-another-scope.html:
* fast/profiler/compare-multiple-profiles.html:
* fast/profiler/constructor.html:
* fast/profiler/dead-time.html:
* fast/profiler/deep-recursion.html:
* fast/profiler/document-dot-write.html:
* fast/profiler/event-handler.html:
* fast/profiler/execution-context-and-eval-on-same-line.html:
* fast/profiler/heavy-view.html:
* fast/profiler/inline-event-handler.html:
* fast/profiler/multiple-and-different-scoped-anonymous-function-calls.html:
* fast/profiler/multiple-and-different-scoped-function-calls.html:
* fast/profiler/multiple-frames.html:
* fast/profiler/nested-anonymous-functon.html:
* fast/profiler/nested-start-and-stop-profiler.html:
* fast/profiler/no-execution-context.html:
* fast/profiler/one-execution-context.html:
* fast/profiler/profile-calls-in-included-file.html:
* fast/profiler/profiling-from-a-nested-location-but-stop-profiling-outside-the-nesting.html:
* fast/profiler/profiling-from-a-nested-location.html:
* fast/profiler/simple-event-call.html:
* fast/profiler/simple-no-level-change.html:
* fast/profiler/start-and-stop-profiler-multiple-times.html:
* fast/profiler/start-and-stop-profiling-in-the-same-function.html:
* fast/profiler/start-but-dont-stop-profiling.html:
* fast/profiler/stop-profiling-after-setTimeout.html:
* fast/profiler/stop-then-function-call.html:
* fast/profiler/throw-exception-from-eval.html:
* fast/profiler/two-execution-contexts.html:
* fast/profiler/user-defined-function-calls-built-in-functions.html:
* fast/profiler/window-dot-eval.html:
2008-10-23 Darin Adler <darin@apple.com>
- try to get buildbot green again
......
......@@ -2,6 +2,9 @@
<head>
<script src="resources/profiler-test-JS-resources.js"></script>
<script>
if (window.layoutTestController)
layoutTestController.dumpAsText();
console.profile("Anonymous event handler");
function testStart()
{
......
......@@ -2,6 +2,9 @@
<head>
<script src="resources/profiler-test-JS-resources.js"></script>
<script>
if (window.layoutTestController)
layoutTestController.dumpAsText();
console.profile("Same anonymous function called from different contexts");
function startTest()
{
......
......@@ -2,6 +2,9 @@
<head>
<script src="resources/profiler-test-JS-resources.js"></script>
<script>
if (window.layoutTestController)
layoutTestController.dumpAsText();
console.profile("Anonymous function calls built-in functions");
function startTest()
{
......
......@@ -2,6 +2,9 @@
<head>
<script src="resources/profiler-test-JS-resources.js"></script>
<script>
if (window.layoutTestController)
layoutTestController.dumpAsText();
console.profile("Anonymous function calles eval");
function startTest()
{
......
......@@ -2,6 +2,9 @@
<head>
<script src="resources/profiler-test-JS-resources.js"></script>
<script>
if (window.layoutTestController)
layoutTestController.dumpAsText();
console.profile("Using the apply() method");
function startTest()
{
......
......@@ -2,6 +2,9 @@
<head>
<script src="resources/profiler-test-JS-resources.js"></script>
<script>
if (window.layoutTestController)
layoutTestController.dumpAsText();
console.profile("Built-in function calls an anonymous function");
function testStart()
{
......
......@@ -2,6 +2,9 @@
<head>
<script src="resources/profiler-test-JS-resources.js"></script>
<script>
if (window.layoutTestController)
layoutTestController.dumpAsText();
console.profile("Built-in function calls a user defined function");
function testStart()
{
......
......@@ -2,6 +2,9 @@
<head>
<script src="resources/profiler-test-JS-resources.js"></script>
<script>
if (window.layoutTestController)
layoutTestController.dumpAsText();
console.profile("Call NodeList as function");
function testStart()
{
......
......@@ -2,6 +2,8 @@
<head>
<script src="resources/profiler-test-JS-resources.js"></script>
<script>
if (window.layoutTestController)
layoutTestController.dumpAsText();
function startTest()
{
......
......@@ -2,6 +2,9 @@
<head>
<script src="resources/profiler-test-JS-resources.js"></script>
<script>
if (window.layoutTestController)
layoutTestController.dumpAsText();
var j = 0;
function test(len) {
for (var i = 0; i < len; ++i)
......@@ -21,6 +24,8 @@ console.profileEnd("Test");
console.profile("Test");
test(1000);
console.profileEnd("Test");
printProfilesDataWithoutTime();
</script>
</head>
......
......@@ -2,6 +2,9 @@
<head>
<script src="resources/profiler-test-JS-resources.js"></script>
<script>
if (window.layoutTestController)
layoutTestController.dumpAsText();
console.profile("Using a constructor.");
function startTest()
{
......
......@@ -2,6 +2,11 @@
<head>
<script src="resources/profiler-test-JS-resources.js"></script>
<script>
if (window.layoutTestController) {
layoutTestController.dumpAsText();
layoutTestController.waitUntilDone();
}
console.profile("Dead time in profile.");
function startTest()
{
......
<html>
<head>
<script src="resources/profiler-test-JS-resources.js"></script>
<script>
if (window.layoutTestController)
layoutTestController.dumpAsText();
console.profile("Test deep recursion.");
function startTest()
{
recurse (0);
console.profileEnd();
endTest();
}
function recurse(depth) {
......
......@@ -2,6 +2,9 @@
<head>
<script src="resources/profiler-test-JS-resources.js"></script>
<script>
if (window.layoutTestController)
layoutTestController.dumpAsText();
console.profile("Call Document.write()");
document.write("<div>This was a triumph.<// div>");
endTest();
......
......@@ -2,6 +2,9 @@
<head>
<script src="resources/profiler-test-JS-resources.js"></script>
<script>
if (window.layoutTestController)
layoutTestController.dumpAsText();
console.profile("Event handler");
function testStart()
{
......
......@@ -2,6 +2,9 @@
<head>
<script src="resources/profiler-test-JS-resources.js"></script>
<script>
if (window.layoutTestController)
layoutTestController.dumpAsText();
console.profile("Two Execution Contexts on the same line");
function testStart()
{
......
......@@ -2,6 +2,9 @@
<head>
<script src="resources/profiler-test-JS-resources.js"></script>
<script>
if (window.layoutTestController)
layoutTestController.dumpAsText();
console.profile("Heavy View Test");
function a()
......@@ -12,6 +15,7 @@ function a()
d();
g();
console.profileEnd();
printHeavyProfilesDataWithoutTime();
}
function b()
......
......@@ -2,6 +2,9 @@
<head>
<script src="resources/profiler-test-JS-resources.js"></script>
<script>
if (window.layoutTestController)
layoutTestController.dumpAsText();
console.profile("Inline event handler");
function testStart()
{
......
......@@ -2,6 +2,9 @@
<head>
<script src="resources/profiler-test-JS-resources.js"></script>
<script>
if (window.layoutTestController)
layoutTestController.dumpAsText();
console.profile("Multiple and different scoped calls to the same anonymous function");
function startTest()
{
......
......@@ -2,6 +2,9 @@
<head>
<script src="resources/profiler-test-JS-resources.js"></script>
<script>
if (window.layoutTestController)
layoutTestController.dumpAsText();
console.profile("Multiple and different scoped calls to the same function");
function startTest()
{
......
......@@ -2,6 +2,9 @@
<head>
<script src="resources/profiler-test-JS-resources.js"></script>
<script>
if (window.layoutTestController)
layoutTestController.dumpAsText();
console.profile("Other window executing JavaScript");
function testStart()
{
......
......@@ -2,6 +2,9 @@
<head>
<script src="resources/profiler-test-JS-resources.js"></script>
<script>
if (window.layoutTestController)
layoutTestController.dumpAsText();
console.profile("Nested anonymous functions called");
function startTest()
{
......
......@@ -2,6 +2,9 @@
<head>
<script src="resources/profiler-test-JS-resources.js"></script>
<script>
if (window.layoutTestController)
layoutTestController.dumpAsText();
console.profile("Start the profiler the first time.");
function startTest()
{
......
<html>
<head>
</head>
<body>
<script src="resources/profiler-test-JS-resources.js"></script>
<script>
if (window.layoutTestController)
layoutTestController.dumpAsText();
</script>
<body onload="printProfilesDataWithoutTime()">
This page has a no script tag and so has no execution context or profiling information.
<br>
<br>
......
<html>
<head>
<script src="resources/profiler-test-JS-resources.js"></script>
<script>
if (window.layoutTestController)
layoutTestController.dumpAsText();
console.profile("One Execution Context");
function testStart()
{
endTest();
}
function endTest() {
console.profileEnd();
}
</script>
</head>
......
......@@ -2,9 +2,13 @@
<head>
<script src="resources/profiler-test-JS-resources.js"></script>
<script>
if (window.layoutTestController)
layoutTestController.dumpAsText();
function testStart()
{
startProfile("Profile call in included file");
endTest();
}
</script>
</head>
......
......@@ -2,6 +2,8 @@
<head>
<script src="resources/profiler-test-JS-resources.js"></script>
<script>
if (window.layoutTestController)
layoutTestController.dumpAsText();
function startTest()
{
......
......@@ -2,6 +2,8 @@
<head>
<script src="resources/profiler-test-JS-resources.js"></script>
<script>
if (window.layoutTestController)
layoutTestController.dumpAsText();
function startTest()
{
......
function endTest() {
console.profileEnd();
printProfilesDataWithoutTime();
if (window.layoutTestController)
layoutTestController.notifyDone();
}
function insertGivenText(text) {
......@@ -38,3 +42,40 @@ function startProfile(title)
{
console.profile(title);
}
function printHeavyProfilesDataWithoutTime()
{
var profiles = console.profiles;
for (var i = 0; i < profiles.length; ++i) {
console.log(profiles[i].title);
printProfileNodeWithoutTime(profiles[i].heavyProfile.head, 0);
}
}
function printProfilesDataWithoutTime()
{
var profiles = console.profiles;
for (var i = 0; i < profiles.length; ++i) {
console.log(profiles[i].title);
printProfileNodeWithoutTime(profiles[i].treeProfile.head, 0);
}
}
function printProfileNodeWithoutTime(node, indentLevel)
{
if (!node.visible)
return;
var space = "";
for (var i = 0; i < indentLevel; ++i)
space += " "
++indentLevel;
console.log(space + node.functionName + " " + node.url + " " + node.lineNumber);
var children = node.children;
for (var i = 0; i < children.length; ++i)
printProfileNodeWithoutTime(children[i], indentLevel);
}
<html>
<head>
<script src="resources/profiler-test-JS-resources.js"></script>
<script>
if (window.layoutTestController)
layoutTestController.dumpAsText();
console.profile("A simple profile test where an event happens.");
function startTest()
{
console.profileEnd();
endTest();
}
</script>
</head>
......
<html>
<head>
<script src="resources/profiler-test-JS-resources.js"></script>
<script>
if (window.layoutTestController)
layoutTestController.dumpAsText();
function startTest()
{
functionWichStartsAndStopsTheProfiler();
......@@ -16,6 +20,7 @@ function functionWichStartsAndStopsTheProfiler()
document.getElementById("output");
console.profileEnd();
printProfilesDataWithoutTime();
}
</script>
......
......@@ -2,6 +2,9 @@
<head>
<script src="resources/profiler-test-JS-resources.js"></script>
<script>
if (window.layoutTestController)
layoutTestController.dumpAsText();
console.profile("Start the profiler the first time.");
function startTest()
{
......
......@@ -2,6 +2,8 @@
<head>
<script src="resources/profiler-test-JS-resources.js"></script>
<script>
if (window.layoutTestController)
layoutTestController.dumpAsText();
function startTest()
{
......@@ -16,6 +18,7 @@ function functionWichStartsAndStopsTheProfiler()
var b = i + 2;
console.profileEnd("Profiling From A Nested Location");
printProfilesDataWithoutTime();
}
</script>
......
......@@ -2,10 +2,14 @@
<head>
<script src="resources/profiler-test-JS-resources.js"></script>
<script>
if (window.layoutTestController)
layoutTestController.dumpAsText();
console.profile("Start the profiler but don't stop it.");
function startTest()
{
anonymousFunction();
printProfilesDataWithoutTime();
}
</script>
</head>
......
......@@ -2,21 +2,15 @@
<head>
<script src="resources/profiler-test-JS-resources.js"></script>
<script>
function startTest()
{
startProfiling();
if (window.layoutTestController) {
layoutTestController.dumpAsText();
layoutTestController.waitUntilDone();
}
function startProfiling()
function startTest()
{
console.profile("Stop profiling from a timeout");
setTimeout("endProfile()", 20);
}
function endProfile()
{
console.profileEnd("Stop profiling from a timeout");
setTimeout("endTest()", 20);
}
</script>
......
<html>
<head>
<script src="resources/profiler-test-JS-resources.js"></script>
<script>
if (window.layoutTestController)
layoutTestController.dumpAsText();
var j = 0;
function test(len) {
for (var i = 0; i < len; ++i)
......@@ -16,6 +20,8 @@ console.profile("Test");
test(1000);
console.profileEnd("Test");
test2(1000);
printProfilesDataWithoutTime();
</script>
</head>
......
......@@ -2,6 +2,9 @@
<head>
<script src="resources/profiler-test-JS-resources.js"></script>
<script>
if (window.layoutTestController)
layoutTestController.dumpAsText();
console.profile("Throw within an eval.");
function testStart()
{
......
<html>
<head>
<script src="resources/profiler-test-JS-resources.js"></script>
<script>
if (window.layoutTestController)
layoutTestController.dumpAsText();
console.profile("Two Execution Contexts");
function testStart()
{
......@@ -24,6 +28,7 @@ the profile. In the profile there should be two (program) elements.
<script>
function testEnd() {
console.profileEnd();
printProfilesDataWithoutTime();
}
</script>
</html>
\ No newline at end of file
<html>
<head>
<script src="resources/profiler-test-JS-resources.js"></script>