| 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 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 83 g_startup_timer_->pause_started_; | 83 g_startup_timer_->pause_started_; |
| 84 | 84 |
| 85 g_startup_timer_->pause_started_ = base::TimeTicks(); | 85 g_startup_timer_->pause_started_ = base::TimeTicks(); |
| 86 } | 86 } |
| 87 | 87 |
| 88 void StartupTimer::Observe(int type, | 88 void StartupTimer::Observe(int type, |
| 89 const content::NotificationSource& source, | 89 const content::NotificationSource& source, |
| 90 const content::NotificationDetails& details) { | 90 const content::NotificationDetails& details) { |
| 91 CHECK(type == chrome::NOTIFICATION_PERFORMANCE_MONITOR_INITIALIZED); | 91 CHECK(type == chrome::NOTIFICATION_PERFORMANCE_MONITOR_INITIALIZED); |
| 92 performance_monitor_initialized_ = true; | 92 performance_monitor_initialized_ = true; |
| 93 if (elapsed_startup_time_ != base::TimeDelta()) | 93 |
| 94 InsertElapsedStartupTime(); | 94 if (PerformanceMonitor::GetInstance()->database_logging_enabled()) { |
| 95 if (elapsed_session_restore_times_.size()) | 95 if (elapsed_startup_time_ != base::TimeDelta()) |
| 96 InsertElapsedSessionRestoreTime(); | 96 InsertElapsedStartupTime(); |
| 97 if (elapsed_session_restore_times_.size()) |
| 98 InsertElapsedSessionRestoreTime(); |
| 99 } |
| 97 } | 100 } |
| 98 | 101 |
| 99 // static | 102 // static |
| 100 void StartupTimer::SetElapsedSessionRestoreTime( | 103 void StartupTimer::SetElapsedSessionRestoreTime( |
| 101 const base::TimeDelta& elapsed_session_restore_time) { | 104 const base::TimeDelta& elapsed_session_restore_time) { |
| 102 g_startup_timer_->elapsed_session_restore_times_.push_back( | 105 g_startup_timer_->elapsed_session_restore_times_.push_back( |
| 103 elapsed_session_restore_time); | 106 elapsed_session_restore_time); |
| 104 | 107 |
| 105 if (g_startup_timer_->performance_monitor_initialized_) | 108 if (g_startup_timer_->performance_monitor_initialized_) |
| 106 g_startup_timer_->InsertElapsedSessionRestoreTime(); | 109 g_startup_timer_->InsertElapsedSessionRestoreTime(); |
| (...skipping 23 matching lines...) Expand all Loading... |
| 130 base::Bind( | 133 base::Bind( |
| 131 &AddMetricToDatabaseOnBackgroundThread, | 134 &AddMetricToDatabaseOnBackgroundThread, |
| 132 base::Unretained(PerformanceMonitor::GetInstance()->database()), | 135 base::Unretained(PerformanceMonitor::GetInstance()->database()), |
| 133 Metric(METRIC_SESSION_RESTORE_TIME, | 136 Metric(METRIC_SESSION_RESTORE_TIME, |
| 134 base::Time::Now(), | 137 base::Time::Now(), |
| 135 static_cast<double>(iter->ToInternalValue())))); | 138 static_cast<double>(iter->ToInternalValue())))); |
| 136 } | 139 } |
| 137 } | 140 } |
| 138 | 141 |
| 139 } // namespace performance_monitor | 142 } // namespace performance_monitor |
| OLD | NEW |