diff options
author | erikkay@google.com <erikkay@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2008-09-02 16:42:15 +0000 |
---|---|---|
committer | erikkay@google.com <erikkay@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2008-09-02 16:42:15 +0000 |
commit | d49a6264617043a450e776984a76468b542ba411 (patch) | |
tree | 739da24590680b5c6e6e789db4d1b44e4ac8115a /webkit | |
parent | bcfad371249f11b922d3b7695286626331551b12 (diff) | |
download | chromium_src-d49a6264617043a450e776984a76468b542ba411.zip chromium_src-d49a6264617043a450e776984a76468b542ba411.tar.gz chromium_src-d49a6264617043a450e776984a76468b542ba411.tar.bz2 |
Initial pass at simple event tracing. I added a few traces to tcp_socket and test_shell to get an idea of what a simple trace might look like.
Here's a sample output line:
11:24:19.660604 0x1e278:0x1e24c BEGIN url.load [0x5 http://mail.google.com/mail/] <E:\src\cr\src\webkit\tools\test_shell\test_webview_delegate.cc:189>
format is:hh:mm:ss.us pid:tid TYPE NAME [id, extra] <file:line>
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@1641 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'webkit')
-rw-r--r-- | webkit/port/bindings/v8/v8_proxy.cpp | 8 | ||||
-rw-r--r-- | webkit/tools/test_shell/test_shell.cc | 2 | ||||
-rw-r--r-- | webkit/tools/test_shell/test_shell_main.cc | 10 | ||||
-rw-r--r-- | webkit/tools/test_shell/test_shell_switches.cc | 6 | ||||
-rw-r--r-- | webkit/tools/test_shell/test_shell_switches.h | 2 | ||||
-rw-r--r-- | webkit/tools/test_shell/test_webview_delegate.cc | 4 |
6 files changed, 31 insertions, 1 deletions
diff --git a/webkit/port/bindings/v8/v8_proxy.cpp b/webkit/port/bindings/v8/v8_proxy.cpp index 5cfcd62..5ce4607 100644 --- a/webkit/port/bindings/v8/v8_proxy.cpp +++ b/webkit/port/bindings/v8/v8_proxy.cpp @@ -97,6 +97,7 @@ #endif #include "base/stats_table.h" +#include "base/trace_event.h" #include "webkit/glue/glue_util.h" #include "webkit/glue/webkit_glue.h" @@ -960,12 +961,17 @@ v8::Local<v8::Value> V8Proxy::Evaluate(const String& fileName, int baseLine, // Compile the script. v8::Local<v8::String> code = v8ExternalString(str); + TRACE_EVENT_BEGIN("v8.compile", n, ""); v8::Handle<v8::Script> script = CompileScript(code, fileName, baseLine); + TRACE_EVENT_END("v8.compile", n, ""); // Set inlineCode to true for <a href="javascript:doSomething()"> // and false for <script>doSomething</script>. For some reason, fileName // gives us this information. - return RunScript(script, fileName.isNull()); + TRACE_EVENT_BEGIN("v8.run", n, ""); + v8::Local<v8::Value> result = RunScript(script, fileName.isNull()); + TRACE_EVENT_END("v8.run", n, ""); + return result; } diff --git a/webkit/tools/test_shell/test_shell.cc b/webkit/tools/test_shell/test_shell.cc index fdd8e46..ec8b023 100644 --- a/webkit/tools/test_shell/test_shell.cc +++ b/webkit/tools/test_shell/test_shell.cc @@ -24,6 +24,7 @@ #include "base/path_service.h" #include "base/stats_table.h" #include "base/string_util.h" +#include "base/trace_event.h" #include "base/win_util.h" #include "googleurl/src/url_util.h" #include "net/base/mime_util.h" @@ -816,6 +817,7 @@ void TestShell::LoadURLForFrame(const wchar_t* url, if (!url) return; + TRACE_EVENT_BEGIN("url.load", this, WideToUTF8(url)); bool bIsSVGTest = wcsstr(url, L"W3C-SVG-1.1") > 0; if (bIsSVGTest) { diff --git a/webkit/tools/test_shell/test_shell_main.cc b/webkit/tools/test_shell/test_shell_main.cc index 6117cda..0383424 100644 --- a/webkit/tools/test_shell/test_shell_main.cc +++ b/webkit/tools/test_shell/test_shell_main.cc @@ -23,10 +23,12 @@ #include "base/stack_container.h" #include "base/stats_table.h" #include "base/string_util.h" +#include "base/trace_event.h" #include "breakpad/src/client/windows/handler/exception_handler.h" #include "net/base/cookie_monster.h" #include "net/base/net_module.h" #include "net/http/http_cache.h" +#include "net/http/http_network_layer.h" #include "net/url_request/url_request_context.h" #include "webkit/glue/webkit_glue.h" #include "webkit/glue/window_open_disposition.h" @@ -140,6 +142,14 @@ int main(int argc, char* argv[]) _set_abort_behavior(0, _WRITE_ABORT_MSG); } + if (parsed_command_line.HasSwitch(test_shell::kEnableTracing)) + base::TraceLog::StartTracing(); + + // Make the selection of network stacks early on before any consumers try to + // issue HTTP requests. + if (parsed_command_line.HasSwitch(test_shell::kUseNewHttp)) + net::HttpNetworkLayer::UseWinHttp(false); + bool layout_test_mode = parsed_command_line.HasSwitch(test_shell::kLayoutTests); diff --git a/webkit/tools/test_shell/test_shell_switches.cc b/webkit/tools/test_shell/test_shell_switches.cc index b39c9b7..540e8e6 100644 --- a/webkit/tools/test_shell/test_shell_switches.cc +++ b/webkit/tools/test_shell/test_shell_switches.cc @@ -48,5 +48,11 @@ const wchar_t kDebugMemoryInUse[] = L"debug-memory-in-use"; // Enable cookies on the file:// scheme. --layout-tests also enables this. const wchar_t kEnableFileCookies[] = L"enable-file-cookies"; +// Enable new HTTP stack. +const wchar_t kUseNewHttp[] = L"new-http"; + +// Enable tracing events (see base/trace_event.h) +const wchar_t kEnableTracing[] = L"enable-tracing"; + } // namespace test_shell diff --git a/webkit/tools/test_shell/test_shell_switches.h b/webkit/tools/test_shell/test_shell_switches.h index 9d057c0..7bb9157 100644 --- a/webkit/tools/test_shell/test_shell_switches.h +++ b/webkit/tools/test_shell/test_shell_switches.h @@ -24,6 +24,8 @@ extern const wchar_t kDumpStatsTable[]; extern const wchar_t kCacheDir[]; extern const wchar_t kDebugMemoryInUse[]; extern const wchar_t kEnableFileCookies[]; +extern const wchar_t kUseNewHttp[]; +extern const wchar_t kEnableTracing[]; } // namespace test_shell diff --git a/webkit/tools/test_shell/test_webview_delegate.cc b/webkit/tools/test_shell/test_webview_delegate.cc index 55f9285..2737ed6 100644 --- a/webkit/tools/test_shell/test_webview_delegate.cc +++ b/webkit/tools/test_shell/test_webview_delegate.cc @@ -14,6 +14,7 @@ #include "base/gfx/point.h" #include "base/message_loop.h" #include "base/string_util.h" +#include "base/trace_event.h" #include "net/base/net_errors.h" #include "webkit/glue/webdatasource.h" #include "webkit/glue/webdropdata.h" @@ -185,12 +186,14 @@ void TestWebViewDelegate::WillSendRequest(WebView* webview, request_url.c_str()); } + TRACE_EVENT_BEGIN("url.load", identifier, request_url); // Set the new substituted URL. request->SetURL(GURL(TestShell::RewriteLocalUrl(request_url))); } void TestWebViewDelegate::DidFinishLoading(WebView* webview, uint32 identifier) { + TRACE_EVENT_END("url.load", identifier, ""); if (shell_->ShouldDumpResourceLoadCallbacks()) { printf("%s - didFinishLoading\n", GetResourceDescription(identifier).c_str()); @@ -304,6 +307,7 @@ void TestWebViewDelegate::DidReceiveTitle(WebView* webview, void TestWebViewDelegate::DidFinishLoadForFrame(WebView* webview, WebFrame* frame) { + TRACE_EVENT_END("frame.load", this, frame->GetURL().spec()); if (shell_->ShouldDumpFrameLoadCallbacks()) { printf("%S - didFinishLoadForFrame\n", GetFrameDescription(frame).c_str()); |