| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 "components/startup_metric_utils/startup_metric_utils.h" | 5 #include "components/startup_metric_utils/startup_metric_utils.h" |
| 6 | 6 |
| 7 #include "base/containers/hash_tables.h" | 7 #include "base/containers/hash_tables.h" |
| 8 #include "base/environment.h" | 8 #include "base/environment.h" |
| 9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #include "base/metrics/histogram_macros.h" | 10 #include "base/metrics/histogram_macros.h" |
| (...skipping 214 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 225 MainEntryPointTimeInternal(); | 225 MainEntryPointTimeInternal(); |
| 226 } | 226 } |
| 227 | 227 |
| 228 void RecordExeMainEntryTime() { | 228 void RecordExeMainEntryTime() { |
| 229 std::string exe_load_time = | 229 std::string exe_load_time = |
| 230 base::Int64ToString(base::Time::Now().ToInternalValue()); | 230 base::Int64ToString(base::Time::Now().ToInternalValue()); |
| 231 scoped_ptr<base::Environment> env(base::Environment::Create()); | 231 scoped_ptr<base::Environment> env(base::Environment::Create()); |
| 232 env->SetVar(kChromeMainTimeEnvVar, exe_load_time); | 232 env->SetVar(kChromeMainTimeEnvVar, exe_load_time); |
| 233 } | 233 } |
| 234 | 234 |
| 235 #if defined(OS_ANDROID) | |
| 236 void RecordSavedMainEntryPointTime(const base::Time& entry_point_time) { | 235 void RecordSavedMainEntryPointTime(const base::Time& entry_point_time) { |
| 237 DCHECK(!g_main_entry_time_was_recorded); | 236 DCHECK(!g_main_entry_time_was_recorded); |
| 238 g_main_entry_time_was_recorded = true; | 237 g_main_entry_time_was_recorded = true; |
| 239 *MainEntryPointTimeInternal() = entry_point_time; | 238 *MainEntryPointTimeInternal() = entry_point_time; |
| 240 } | 239 } |
| 241 #endif // OS_ANDROID | |
| 242 | 240 |
| 243 // Return the time recorded by RecordMainEntryPointTime(). | 241 // Return the time recorded by RecordMainEntryPointTime(). |
| 244 const base::Time MainEntryStartTime() { | 242 const base::Time MainEntryStartTime() { |
| 245 DCHECK(g_main_entry_time_was_recorded); | 243 DCHECK(g_main_entry_time_was_recorded); |
| 246 return *MainEntryPointTimeInternal(); | 244 return *MainEntryPointTimeInternal(); |
| 247 } | 245 } |
| 248 | 246 |
| 249 void OnBrowserStartupComplete(bool is_first_run) { | 247 void OnBrowserStartupComplete(bool is_first_run) { |
| 250 RecordHardFaultHistogram(is_first_run); | 248 RecordHardFaultHistogram(is_first_run); |
| 251 RecordMainEntryTimeHistogram(); | 249 RecordMainEntryTimeHistogram(); |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 311 #endif | 309 #endif |
| 312 } | 310 } |
| 313 | 311 |
| 314 const base::Time* MainEntryPointTime() { | 312 const base::Time* MainEntryPointTime() { |
| 315 if (!g_main_entry_time_was_recorded) | 313 if (!g_main_entry_time_was_recorded) |
| 316 return NULL; | 314 return NULL; |
| 317 return MainEntryPointTimeInternal(); | 315 return MainEntryPointTimeInternal(); |
| 318 } | 316 } |
| 319 | 317 |
| 320 } // namespace startup_metric_utils | 318 } // namespace startup_metric_utils |
| OLD | NEW |