| 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/browser/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/lazy_instance.h" | 9 #include "base/lazy_instance.h" |
| 10 #include "base/logging.h" | 10 #include "base/logging.h" |
| 11 #include "base/metrics/histogram_macros.h" | 11 #include "base/metrics/histogram_macros.h" |
| 12 #include "base/strings/string_number_conversions.h" | 12 #include "base/strings/string_number_conversions.h" |
| 13 #include "base/sys_info.h" | 13 #include "base/sys_info.h" |
| 14 #include "base/trace_event/trace_event.h" | 14 #include "base/trace_event/trace_event.h" |
| 15 | 15 |
| (...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 176 } \ | 176 } \ |
| 177 } | 177 } |
| 178 | 178 |
| 179 #define UMA_HISTOGRAM_AND_TRACE_WITH_STARTUP_TEMPERATURE(type, basename, \ | 179 #define UMA_HISTOGRAM_AND_TRACE_WITH_STARTUP_TEMPERATURE(type, basename, \ |
| 180 begin_time, end_time) \ | 180 begin_time, end_time) \ |
| 181 { \ | 181 { \ |
| 182 UMA_HISTOGRAM_WITH_STARTUP_TEMPERATURE(type, basename, \ | 182 UMA_HISTOGRAM_WITH_STARTUP_TEMPERATURE(type, basename, \ |
| 183 end_time - begin_time) \ | 183 end_time - begin_time) \ |
| 184 TRACE_EVENT_ASYNC_BEGIN_WITH_TIMESTAMP1( \ | 184 TRACE_EVENT_ASYNC_BEGIN_WITH_TIMESTAMP1( \ |
| 185 "startup", basename, 0, \ | 185 "startup", basename, 0, \ |
| 186 StartupTimeToTimeTicks(begin_time).ToInternalValue(), "Temperature", \ | 186 StartupTimeToTimeTicks(begin_time).ToInternalValue(), "Temperature", \ |
| 187 g_startup_temperature); \ | 187 g_startup_temperature); \ |
| 188 TRACE_EVENT_ASYNC_END_WITH_TIMESTAMP1( \ | 188 TRACE_EVENT_ASYNC_END_WITH_TIMESTAMP1( \ |
| 189 "startup", basename, 0, \ | 189 "startup", basename, 0, \ |
| 190 StartupTimeToTimeTicks(end_time).ToInternalValue(), "Temperature", \ | 190 StartupTimeToTimeTicks(end_time).ToInternalValue(), "Temperature", \ |
| 191 g_startup_temperature); \ | 191 g_startup_temperature); \ |
| 192 } | 192 } |
| 193 | 193 |
| 194 // On Windows, records the number of hard-faults that have occurred in the | 194 // On Windows, records the number of hard-faults that have occurred in the |
| 195 // current chrome.exe process since it was started. This is a nop on other | 195 // current chrome.exe process since it was started. This is a nop on other |
| 196 // platforms. | 196 // platforms. |
| 197 // crbug.com/476923 | 197 // crbug.com/476923 |
| 198 // TODO(chrisha): If this proves useful, use it to split startup stats in two. | 198 // TODO(chrisha): If this proves useful, use it to split startup stats in two. |
| 199 void RecordHardFaultHistogram(bool is_first_run) { | 199 void RecordHardFaultHistogram(bool is_first_run) { |
| 200 #if defined(OS_WIN) | 200 #if defined(OS_WIN) |
| (...skipping 298 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 499 | 499 |
| 500 base::Time MainEntryPointTime() { | 500 base::Time MainEntryPointTime() { |
| 501 return g_main_entry_point_time.Get(); | 501 return g_main_entry_point_time.Get(); |
| 502 } | 502 } |
| 503 | 503 |
| 504 StartupTemperature GetStartupTemperature() { | 504 StartupTemperature GetStartupTemperature() { |
| 505 return g_startup_temperature; | 505 return g_startup_temperature; |
| 506 } | 506 } |
| 507 | 507 |
| 508 } // namespace startup_metric_utils | 508 } // namespace startup_metric_utils |
| OLD | NEW |