OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "chrome/browser/performance_monitor/performance_monitor.h" | 5 #include "chrome/browser/performance_monitor/performance_monitor.h" |
6 | 6 |
7 #include "base/memory/singleton.h" | 7 #include "base/memory/singleton.h" |
8 #include "base/process/process_iterator.h" | 8 #include "base/process/process_iterator.h" |
9 #include "base/strings/utf_string_conversions.h" | 9 #include "base/strings/utf_string_conversions.h" |
10 #include "base/time/time.h" | 10 #include "base/time/time.h" |
(...skipping 23 matching lines...) Expand all Loading... |
34 namespace performance_monitor { | 34 namespace performance_monitor { |
35 | 35 |
36 PerformanceMonitor::PerformanceMonitor() { | 36 PerformanceMonitor::PerformanceMonitor() { |
37 } | 37 } |
38 | 38 |
39 PerformanceMonitor::~PerformanceMonitor() { | 39 PerformanceMonitor::~PerformanceMonitor() { |
40 } | 40 } |
41 | 41 |
42 // static | 42 // static |
43 PerformanceMonitor* PerformanceMonitor::GetInstance() { | 43 PerformanceMonitor* PerformanceMonitor::GetInstance() { |
44 return Singleton<PerformanceMonitor>::get(); | 44 return base::Singleton<PerformanceMonitor>::get(); |
45 } | 45 } |
46 | 46 |
47 void PerformanceMonitor::StartGatherCycle() { | 47 void PerformanceMonitor::StartGatherCycle() { |
48 DCHECK_CURRENTLY_ON(BrowserThread::UI); | 48 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
49 repeating_timer_.Start(FROM_HERE, | 49 repeating_timer_.Start(FROM_HERE, |
50 base::TimeDelta::FromSeconds(kGatherIntervalInSeconds), | 50 base::TimeDelta::FromSeconds(kGatherIntervalInSeconds), |
51 this, &PerformanceMonitor::GatherMetricsMapOnUIThread); | 51 this, &PerformanceMonitor::GatherMetricsMapOnUIThread); |
52 } | 52 } |
53 | 53 |
54 namespace { | 54 namespace { |
(...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
208 void PerformanceMonitor::RunTriggersUIThread() { | 208 void PerformanceMonitor::RunTriggersUIThread() { |
209 DCHECK_CURRENTLY_ON(BrowserThread::UI); | 209 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
210 for (auto it = metrics_map_.begin(); it != metrics_map_.end(); ++it) { | 210 for (auto it = metrics_map_.begin(); it != metrics_map_.end(); ++it) { |
211 it->second.RunPerformanceTriggers(); | 211 it->second.RunPerformanceTriggers(); |
212 } | 212 } |
213 | 213 |
214 StartGatherCycle(); | 214 StartGatherCycle(); |
215 } | 215 } |
216 | 216 |
217 } // namespace performance_monitor | 217 } // namespace performance_monitor |
OLD | NEW |