Chromium Code Reviews| 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/startup_timer.h" | 5 #include "chrome/browser/performance_monitor/startup_timer.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/logging.h" | 8 #include "base/logging.h" |
| 9 #include "base/strings/string_number_conversions.h" | 9 #include "base/strings/string_number_conversions.h" |
| 10 #include "chrome/browser/chrome_notification_types.h" | 10 #include "chrome/browser/chrome_notification_types.h" |
| (...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 105 if (PerformanceMonitor::GetInstance()->database_logging_enabled()) { | 105 if (PerformanceMonitor::GetInstance()->database_logging_enabled()) { |
| 106 g_startup_timer_->elapsed_session_restore_times_.push_back( | 106 g_startup_timer_->elapsed_session_restore_times_.push_back( |
| 107 elapsed_session_restore_time); | 107 elapsed_session_restore_time); |
| 108 | 108 |
| 109 if (g_startup_timer_->performance_monitor_initialized_) | 109 if (g_startup_timer_->performance_monitor_initialized_) |
| 110 g_startup_timer_->InsertElapsedSessionRestoreTime(); | 110 g_startup_timer_->InsertElapsedSessionRestoreTime(); |
| 111 } | 111 } |
| 112 } | 112 } |
| 113 | 113 |
| 114 void StartupTimer::InsertElapsedStartupTime() { | 114 void StartupTimer::InsertElapsedStartupTime() { |
| 115 performance_monitor::Database* database = | |
|
Yoyo Zhou
2013/10/04 18:12:07
This file is still in this CL for some reason.
Finnur
2013/10/11 10:59:22
Removed.
| |
| 116 PerformanceMonitor::GetInstance()->database(); | |
| 115 content::BrowserThread::PostBlockingPoolSequencedTask( | 117 content::BrowserThread::PostBlockingPoolSequencedTask( |
| 116 Database::kDatabaseSequenceToken, | 118 Database::kDatabaseSequenceToken, |
| 117 FROM_HERE, | 119 FROM_HERE, |
| 118 base::Bind( | 120 base::Bind( |
| 119 &AddMetricToDatabaseOnBackgroundThread, | 121 &AddMetricToDatabaseOnBackgroundThread, |
| 120 base::Unretained(PerformanceMonitor::GetInstance()->database()), | 122 base::Unretained(database), |
| 121 Metric(startup_type_ == STARTUP_NORMAL ? METRIC_STARTUP_TIME | 123 Metric(startup_type_ == STARTUP_NORMAL ? METRIC_STARTUP_TIME |
| 122 : METRIC_TEST_STARTUP_TIME, | 124 : METRIC_TEST_STARTUP_TIME, |
| 123 base::Time::Now(), | 125 base::Time::Now(), |
| 124 static_cast<double>( | 126 static_cast<double>( |
| 125 elapsed_startup_time_.ToInternalValue())))); | 127 elapsed_startup_time_.ToInternalValue())))); |
| 126 } | 128 } |
| 127 | 129 |
| 128 void StartupTimer::InsertElapsedSessionRestoreTime() { | 130 void StartupTimer::InsertElapsedSessionRestoreTime() { |
| 129 for (std::vector<base::TimeDelta>::const_iterator iter = | 131 for (std::vector<base::TimeDelta>::const_iterator iter = |
| 130 elapsed_session_restore_times_.begin(); | 132 elapsed_session_restore_times_.begin(); |
| 131 iter != elapsed_session_restore_times_.end(); ++iter) { | 133 iter != elapsed_session_restore_times_.end(); ++iter) { |
| 134 performance_monitor::Database* database = | |
| 135 PerformanceMonitor::GetInstance()->database(); | |
| 132 content::BrowserThread::PostBlockingPoolSequencedTask( | 136 content::BrowserThread::PostBlockingPoolSequencedTask( |
| 133 Database::kDatabaseSequenceToken, | 137 Database::kDatabaseSequenceToken, |
| 134 FROM_HERE, | 138 FROM_HERE, |
| 135 base::Bind( | 139 base::Bind( |
| 136 &AddMetricToDatabaseOnBackgroundThread, | 140 &AddMetricToDatabaseOnBackgroundThread, |
| 137 base::Unretained(PerformanceMonitor::GetInstance()->database()), | 141 base::Unretained(database), |
| 138 Metric(METRIC_SESSION_RESTORE_TIME, | 142 Metric(METRIC_SESSION_RESTORE_TIME, |
| 139 base::Time::Now(), | 143 base::Time::Now(), |
| 140 static_cast<double>(iter->ToInternalValue())))); | 144 static_cast<double>(iter->ToInternalValue())))); |
| 141 } | 145 } |
| 142 } | 146 } |
| 143 | 147 |
| 144 } // namespace performance_monitor | 148 } // namespace performance_monitor |
| OLD | NEW |