Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #if defined(OS_MACOSX) | 5 #if defined(OS_MACOSX) |
| 6 #include <signal.h> | 6 #include <signal.h> |
| 7 #include <unistd.h> | 7 #include <unistd.h> |
| 8 #endif // OS_MACOSX | 8 #endif // OS_MACOSX |
| 9 | 9 |
| 10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
| (...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 211 // This is a simplified version of the browser Jankometer, which measures | 211 // This is a simplified version of the browser Jankometer, which measures |
| 212 // the processing time of tasks on the render thread. | 212 // the processing time of tasks on the render thread. |
| 213 class RendererMessageLoopObserver : public MessageLoop::TaskObserver { | 213 class RendererMessageLoopObserver : public MessageLoop::TaskObserver { |
| 214 public: | 214 public: |
| 215 RendererMessageLoopObserver() | 215 RendererMessageLoopObserver() |
| 216 : process_times_(base::Histogram::FactoryGet( | 216 : process_times_(base::Histogram::FactoryGet( |
| 217 "Chrome.ProcMsgL RenderThread", | 217 "Chrome.ProcMsgL RenderThread", |
| 218 1, 3600000, 50, base::Histogram::kUmaTargetedHistogramFlag)) {} | 218 1, 3600000, 50, base::Histogram::kUmaTargetedHistogramFlag)) {} |
| 219 virtual ~RendererMessageLoopObserver() {} | 219 virtual ~RendererMessageLoopObserver() {} |
| 220 | 220 |
| 221 virtual void WillProcessTask(const Task* task) { | 221 virtual void WillProcessTask(base::TimeTicks time_posted) { |
| 222 begin_process_message_ = base::TimeTicks::Now(); | 222 begin_process_message_ = base::TimeTicks::Now(); |
| 223 } | 223 } |
| 224 | 224 |
| 225 virtual void DidProcessTask(const Task* task) { | 225 virtual void DidProcessTask(base::TimeTicks time_posted) { |
| 226 if (begin_process_message_ != base::TimeTicks()) | 226 if (begin_process_message_ != base::TimeTicks()) |
|
joth
2011/04/16 15:11:57
suggest
if (begin_process_message_.is_null())
(al
awong
2011/04/17 00:34:57
Ooh...good catch.
As for TimeTicks being passed b
| |
| 227 process_times_->AddTime(base::TimeTicks::Now() - begin_process_message_); | 227 process_times_->AddTime(base::TimeTicks::Now() - begin_process_message_); |
| 228 } | 228 } |
| 229 | 229 |
| 230 private: | 230 private: |
| 231 base::TimeTicks begin_process_message_; | 231 base::TimeTicks begin_process_message_; |
| 232 base::Histogram* const process_times_; | 232 base::Histogram* const process_times_; |
| 233 DISALLOW_COPY_AND_ASSIGN(RendererMessageLoopObserver); | 233 DISALLOW_COPY_AND_ASSIGN(RendererMessageLoopObserver); |
| 234 }; | 234 }; |
| 235 | 235 |
| 236 // mainline routine for running as the Renderer process | 236 // mainline routine for running as the Renderer process |
| (...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 363 pool->Recycle(); | 363 pool->Recycle(); |
| 364 TRACE_EVENT_BEGIN("RendererMain.START_MSG_LOOP", 0, 0); | 364 TRACE_EVENT_BEGIN("RendererMain.START_MSG_LOOP", 0, 0); |
| 365 MessageLoop::current()->Run(); | 365 MessageLoop::current()->Run(); |
| 366 TRACE_EVENT_END("RendererMain.START_MSG_LOOP", 0, 0); | 366 TRACE_EVENT_END("RendererMain.START_MSG_LOOP", 0, 0); |
| 367 } | 367 } |
| 368 } | 368 } |
| 369 platform.PlatformUninitialize(); | 369 platform.PlatformUninitialize(); |
| 370 TRACE_EVENT_END("RendererMain", 0, ""); | 370 TRACE_EVENT_END("RendererMain", 0, ""); |
| 371 return 0; | 371 return 0; |
| 372 } | 372 } |
| OLD | NEW |