Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1266)

Unified Diff: content/gpu/gpu_main.cc

Issue 10386185: Add trace events to measure GPU process startup timing and time to first present. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 8 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: content/gpu/gpu_main.cc
===================================================================
--- content/gpu/gpu_main.cc (revision 137679)
+++ content/gpu/gpu_main.cc (working copy)
@@ -8,6 +8,7 @@
#include <windows.h>
#endif
+#include "base/debug/trace_event.h"
#include "base/environment.h"
#include "base/message_loop.h"
#include "base/rand_util.h"
@@ -41,6 +42,8 @@
// Main function for starting the Gpu process.
int GpuMain(const content::MainFunctionParams& parameters) {
+ TRACE_EVENT0("gpu", "GpuMain");
+
base::Time start_time = base::Time::Now();
const CommandLine& command_line = parameters.command_line;
@@ -100,36 +103,57 @@
dead_on_arrival = true;
}
- // Warm up the random subsystem, which needs to be done pre-sandbox on all
- // platforms.
- (void) base::RandUint64();
+ {
+ TRACE_EVENT0("gpu", "Warm up rand");
+ // Warm up the random subsystem, which needs to be done pre-sandbox on all
+ // platforms.
+ (void) base::RandUint64();
+ }
+ {
+ TRACE_EVENT0("gpu", "Warm up HMAC");
+ // Warm up the crypto subsystem, which needs to done pre-sandbox on all
+ // platforms.
+ crypto::HMAC hmac(crypto::HMAC::SHA256);
+ unsigned char key = '\0';
+ bool ret = hmac.Init(&key, sizeof(key));
+ (void) ret;
+ }
- // Warm up the crypto subsystem, which needs to done pre-sandbox on all
- // platforms.
- crypto::HMAC hmac(crypto::HMAC::SHA256);
- unsigned char key = '\0';
- bool ret = hmac.Init(&key, sizeof(key));
- (void) ret;
-
#if defined(OS_LINUX) && !defined(OS_CHROMEOS)
- content::InitializeSandbox();
+ {
+ TRACE_EVENT0("gpu", "Initialize sandbox");
+ content::InitializeSandbox();
+ }
#endif
- base::win::ScopedCOMInitializer com_initializer;
+ {
+ TRACE_EVENT0("gpu", "Initialize COM");
+ base::win::ScopedCOMInitializer com_initializer;
+ }
#if defined(OS_WIN)
- // Preload this DLL because the sandbox prevents it from loading.
- LoadLibrary(L"setupapi.dll");
+ {
+ TRACE_EVENT0("gpu", "Preload setupapi.dll");
+ // Preload this DLL because the sandbox prevents it from loading.
+ LoadLibrary(L"setupapi.dll");
+ }
- sandbox::TargetServices* target_services =
- parameters.sandbox_info->target_services;
- // Initialize H/W video decoding stuff which fails in the sandbox.
- DXVAVideoDecodeAccelerator::PreSandboxInitialization();
- // For windows, if the target_services interface is not zero, the process
- // is sandboxed and we must call LowerToken() before rendering untrusted
- // content.
- if (target_services)
- target_services->LowerToken();
+ {
+ TRACE_EVENT0("gpu", "Initialize DXVA");
+ // Initialize H/W video decoding stuff which fails in the sandbox.
+ DXVAVideoDecodeAccelerator::PreSandboxInitialization();
+ }
+
+ {
+ TRACE_EVENT0("gpu", "Lower token");
+ // For windows, if the target_services interface is not zero, the process
+ // is sandboxed and we must call LowerToken() before rendering untrusted
+ // content.
+ sandbox::TargetServices* target_services =
+ parameters.sandbox_info->target_services;
+ if (target_services)
+ target_services->LowerToken();
+ }
#endif
MessageLoop::Type message_loop_type = MessageLoop::TYPE_UI;
@@ -158,7 +182,10 @@
gpu_process.set_main_thread(child_thread);
- main_message_loop.Run();
+ {
+ TRACE_EVENT0("gpu", "Run Message Loop");
+ main_message_loop.Run();
+ }
child_thread->StopWatchdog();

Powered by Google App Engine
This is Rietveld 408576698