| 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/browser/startup_metric_utils.h" | 
| 6 | 6 | 
| 7 #include <stddef.h> | 7 #include <stddef.h> | 
| 8 | 8 | 
| 9 #include "base/containers/hash_tables.h" | 9 #include "base/containers/hash_tables.h" | 
| 10 #include "base/environment.h" | 10 #include "base/environment.h" | 
| (...skipping 251 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 262 // also the time taken to synchronously resolve base::Time::Now() and | 262 // also the time taken to synchronously resolve base::Time::Now() and | 
| 263 // base::TimeTicks::Now() at play, but in practice it is pretty much instant | 263 // base::TimeTicks::Now() at play, but in practice it is pretty much instant | 
| 264 // compared to multi-seconds startup timings. | 264 // compared to multi-seconds startup timings. | 
| 265 base::TimeTicks StartupTimeToTimeTicks(const base::Time& time) { | 265 base::TimeTicks StartupTimeToTimeTicks(const base::Time& time) { | 
| 266   // First get a base which represents the same point in time in both units. | 266   // First get a base which represents the same point in time in both units. | 
| 267   // Bump the priority of this thread while doing this as the wall clock time it | 267   // Bump the priority of this thread while doing this as the wall clock time it | 
| 268   // takes to resolve these two calls affects the precision of this method and | 268   // takes to resolve these two calls affects the precision of this method and | 
| 269   // bumping the priority reduces the likelihood of a context switch interfering | 269   // bumping the priority reduces the likelihood of a context switch interfering | 
| 270   // with this computation. | 270   // with this computation. | 
| 271 | 271 | 
| 272 // platform_thread_mac.mm unfortunately doesn't properly support base's | 272 // Enabling this logic on OS X causes a significant performance regression. | 
| 273 // thread priority APIs (crbug.com/554651). | 273 // https://crbug.com/601270 | 
| 274 #if !defined(OS_MACOSX) | 274 #if !defined(OS_MACOSX) | 
| 275   static bool statics_initialized = false; | 275   static bool statics_initialized = false; | 
| 276 | 276 | 
| 277   base::ThreadPriority previous_priority = base::ThreadPriority::NORMAL; | 277   base::ThreadPriority previous_priority = base::ThreadPriority::NORMAL; | 
| 278   if (!statics_initialized) { | 278   if (!statics_initialized) { | 
| 279     previous_priority = base::PlatformThread::GetCurrentThreadPriority(); | 279     previous_priority = base::PlatformThread::GetCurrentThreadPriority(); | 
| 280     base::PlatformThread::SetCurrentThreadPriority( | 280     base::PlatformThread::SetCurrentThreadPriority( | 
| 281         base::ThreadPriority::DISPLAY); | 281         base::ThreadPriority::DISPLAY); | 
| 282   } | 282   } | 
| 283 #endif | 283 #endif | 
| (...skipping 418 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 702 | 702 | 
| 703 base::TimeTicks MainEntryPointTicks() { | 703 base::TimeTicks MainEntryPointTicks() { | 
| 704   return g_browser_main_entry_point_ticks.Get(); | 704   return g_browser_main_entry_point_ticks.Get(); | 
| 705 } | 705 } | 
| 706 | 706 | 
| 707 StartupTemperature GetStartupTemperature() { | 707 StartupTemperature GetStartupTemperature() { | 
| 708   return g_startup_temperature; | 708   return g_startup_temperature; | 
| 709 } | 709 } | 
| 710 | 710 | 
| 711 }  // namespace startup_metric_utils | 711 }  // namespace startup_metric_utils | 
| OLD | NEW | 
|---|