OLD | NEW |
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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 #include <limits> | 5 #include <limits> |
6 | 6 |
7 #include "chrome/browser/jankometer.h" | 7 #include "chrome/browser/jankometer.h" |
8 | 8 |
9 #include "base/basictypes.h" | 9 #include "base/basictypes.h" |
10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
11 #include "base/histogram.h" | 11 #include "base/histogram.h" |
12 #include "base/message_loop.h" | 12 #include "base/message_loop.h" |
13 #include "base/ref_counted.h" | 13 #include "base/ref_counted.h" |
14 #include "base/stats_counters.h" | 14 #include "base/stats_counters.h" |
15 #include "base/string_util.h" | 15 #include "base/string_util.h" |
16 #include "base/thread.h" | 16 #include "base/thread.h" |
17 #include "base/time.h" | 17 #include "base/time.h" |
18 #include "base/watchdog.h" | 18 #include "base/watchdog.h" |
19 #include "build/build_config.h" | 19 #include "build/build_config.h" |
20 #include "chrome/browser/browser_process.h" | 20 #include "chrome/browser/browser_process.h" |
21 #include "chrome/common/chrome_switches.h" | 21 #include "chrome/common/chrome_switches.h" |
22 | 22 |
23 #if defined(OS_LINUX) | 23 #if defined(USE_X11) |
24 #include "chrome/common/gtk_util.h" | 24 #include "chrome/common/gtk_util.h" |
25 #endif | 25 #endif |
26 | 26 |
27 using base::TimeDelta; | 27 using base::TimeDelta; |
28 using base::TimeTicks; | 28 using base::TimeTicks; |
29 | 29 |
30 namespace { | 30 namespace { |
31 | 31 |
32 // The maximum threshold of delay of the message before considering it a delay. | 32 // The maximum threshold of delay of the message before considering it a delay. |
33 // For a debug build, you may want to set IO delay around 500ms. | 33 // For a debug build, you may want to set IO delay around 500ms. |
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
167 DWORD cur_time = GetTickCount(); | 167 DWORD cur_time = GetTickCount(); |
168 queueing_time_ = | 168 queueing_time_ = |
169 base::TimeDelta::FromMilliseconds(cur_time - cur_message_issue_time); | 169 base::TimeDelta::FromMilliseconds(cur_time - cur_message_issue_time); |
170 | 170 |
171 StartProcessingTimers(); | 171 StartProcessingTimers(); |
172 } | 172 } |
173 | 173 |
174 virtual void DidProcessMessage(const MSG& msg) { | 174 virtual void DidProcessMessage(const MSG& msg) { |
175 EndProcessingTimers(); | 175 EndProcessingTimers(); |
176 } | 176 } |
177 #elif defined(OS_LINUX) | 177 #elif defined(USE_X11) |
178 virtual void WillProcessEvent(GdkEvent* event) { | 178 virtual void WillProcessEvent(GdkEvent* event) { |
179 begin_process_message_ = TimeTicks::Now(); | 179 begin_process_message_ = TimeTicks::Now(); |
180 // TODO(evanm): we want to set queueing_time_ using | 180 // TODO(evanm): we want to set queueing_time_ using |
181 // gdk_event_get_time, but how do you convert that info | 181 // gdk_event_get_time, but how do you convert that info |
182 // into a delta? | 182 // into a delta? |
183 // guint event_time = gdk_event_get_time(event); | 183 // guint event_time = gdk_event_get_time(event); |
184 queueing_time_ = base::TimeDelta::FromMilliseconds(0); | 184 queueing_time_ = base::TimeDelta::FromMilliseconds(0); |
185 StartProcessingTimers(); | 185 StartProcessingTimers(); |
186 } | 186 } |
187 | 187 |
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
263 ui_observer->Release(); | 263 ui_observer->Release(); |
264 ui_observer = NULL; | 264 ui_observer = NULL; |
265 } | 265 } |
266 if (io_observer) { | 266 if (io_observer) { |
267 // IO thread can't be running when we remove observers. | 267 // IO thread can't be running when we remove observers. |
268 DCHECK((!g_browser_process) || !(g_browser_process->io_thread())); | 268 DCHECK((!g_browser_process) || !(g_browser_process->io_thread())); |
269 io_observer->Release(); | 269 io_observer->Release(); |
270 io_observer = NULL; | 270 io_observer = NULL; |
271 } | 271 } |
272 } | 272 } |
OLD | NEW |