| 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 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 105 // This is a simplified version of the browser Jankometer, which measures | 105 // This is a simplified version of the browser Jankometer, which measures |
| 106 // the processing time of tasks on the render thread. | 106 // the processing time of tasks on the render thread. |
| 107 class RendererMessageLoopObserver : public MessageLoop::TaskObserver { | 107 class RendererMessageLoopObserver : public MessageLoop::TaskObserver { |
| 108 public: | 108 public: |
| 109 RendererMessageLoopObserver() | 109 RendererMessageLoopObserver() |
| 110 : process_times_(base::Histogram::FactoryGet( | 110 : process_times_(base::Histogram::FactoryGet( |
| 111 "Chrome.ProcMsgL RenderThread", | 111 "Chrome.ProcMsgL RenderThread", |
| 112 1, 3600000, 50, base::Histogram::kUmaTargetedHistogramFlag)) {} | 112 1, 3600000, 50, base::Histogram::kUmaTargetedHistogramFlag)) {} |
| 113 virtual ~RendererMessageLoopObserver() {} | 113 virtual ~RendererMessageLoopObserver() {} |
| 114 | 114 |
| 115 virtual void WillProcessTask(const Task* task) { | 115 virtual void WillProcessTask(base::TimeTicks time_posted) { |
| 116 begin_process_message_ = base::TimeTicks::Now(); | 116 begin_process_message_ = base::TimeTicks::Now(); |
| 117 } | 117 } |
| 118 | 118 |
| 119 virtual void DidProcessTask(const Task* task) { | 119 virtual void DidProcessTask(base::TimeTicks time_posted) { |
| 120 if (begin_process_message_ != base::TimeTicks()) | 120 if (!begin_process_message_.is_null()) |
| 121 process_times_->AddTime(base::TimeTicks::Now() - begin_process_message_); | 121 process_times_->AddTime(base::TimeTicks::Now() - begin_process_message_); |
| 122 } | 122 } |
| 123 | 123 |
| 124 private: | 124 private: |
| 125 base::TimeTicks begin_process_message_; | 125 base::TimeTicks begin_process_message_; |
| 126 base::Histogram* const process_times_; | 126 base::Histogram* const process_times_; |
| 127 DISALLOW_COPY_AND_ASSIGN(RendererMessageLoopObserver); | 127 DISALLOW_COPY_AND_ASSIGN(RendererMessageLoopObserver); |
| 128 }; | 128 }; |
| 129 | 129 |
| 130 // mainline routine for running as the Renderer process | 130 // mainline routine for running as the Renderer process |
| (...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 231 pool->Recycle(); | 231 pool->Recycle(); |
| 232 TRACE_EVENT_BEGIN("RendererMain.START_MSG_LOOP", 0, 0); | 232 TRACE_EVENT_BEGIN("RendererMain.START_MSG_LOOP", 0, 0); |
| 233 MessageLoop::current()->Run(); | 233 MessageLoop::current()->Run(); |
| 234 TRACE_EVENT_END("RendererMain.START_MSG_LOOP", 0, 0); | 234 TRACE_EVENT_END("RendererMain.START_MSG_LOOP", 0, 0); |
| 235 } | 235 } |
| 236 } | 236 } |
| 237 platform.PlatformUninitialize(); | 237 platform.PlatformUninitialize(); |
| 238 TRACE_EVENT_END("RendererMain", 0, ""); | 238 TRACE_EVENT_END("RendererMain", 0, ""); |
| 239 return 0; | 239 return 0; |
| 240 } | 240 } |
| OLD | NEW |