 Chromium Code Reviews
 Chromium Code Reviews Issue 19741003:
  Add support for sparse histograms to WebKitPlatformSupportImpl  (Closed) 
  Base URL: svn://svn.chromium.org/chrome/trunk/src
    
  
    Issue 19741003:
  Add support for sparse histograms to WebKitPlatformSupportImpl  (Closed) 
  Base URL: svn://svn.chromium.org/chrome/trunk/src| 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 "webkit/glue/webkitplatformsupport_impl.h" | 5 #include "webkit/glue/webkitplatformsupport_impl.h" | 
| 6 | 6 | 
| 7 #include <math.h> | 7 #include <math.h> | 
| 8 | 8 | 
| 9 #include <vector> | 9 #include <vector> | 
| 10 | 10 | 
| 11 #include "base/allocator/allocator_extension.h" | 11 #include "base/allocator/allocator_extension.h" | 
| 12 #include "base/bind.h" | 12 #include "base/bind.h" | 
| 13 #include "base/files/file_path.h" | 13 #include "base/files/file_path.h" | 
| 14 #include "base/memory/scoped_ptr.h" | 14 #include "base/memory/scoped_ptr.h" | 
| 15 #include "base/memory/singleton.h" | 15 #include "base/memory/singleton.h" | 
| 16 #include "base/message_loop.h" | 16 #include "base/message_loop.h" | 
| 17 #include "base/metrics/histogram.h" | 17 #include "base/metrics/histogram.h" | 
| 18 #include "base/metrics/sparse_histogram.h" | |
| 18 #include "base/metrics/stats_counters.h" | 19 #include "base/metrics/stats_counters.h" | 
| 19 #include "base/platform_file.h" | 20 #include "base/platform_file.h" | 
| 20 #include "base/process_util.h" | 21 #include "base/process_util.h" | 
| 21 #include "base/rand_util.h" | 22 #include "base/rand_util.h" | 
| 22 #include "base/strings/string_number_conversions.h" | 23 #include "base/strings/string_number_conversions.h" | 
| 23 #include "base/strings/string_util.h" | 24 #include "base/strings/string_util.h" | 
| 24 #include "base/strings/utf_string_conversions.h" | 25 #include "base/strings/utf_string_conversions.h" | 
| 25 #include "base/synchronization/lock.h" | 26 #include "base/synchronization/lock.h" | 
| 26 #include "base/sys_info.h" | 27 #include "base/sys_info.h" | 
| 27 #include "base/time/time.h" | 28 #include "base/time/time.h" | 
| (...skipping 408 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 436 const char* name, int sample, int boundary_value) { | 437 const char* name, int sample, int boundary_value) { | 
| 437 // Copied from histogram macro, but without the static variable caching | 438 // Copied from histogram macro, but without the static variable caching | 
| 438 // the histogram because name is dynamic. | 439 // the histogram because name is dynamic. | 
| 439 base::HistogramBase* counter = | 440 base::HistogramBase* counter = | 
| 440 base::LinearHistogram::FactoryGet(name, 1, boundary_value, | 441 base::LinearHistogram::FactoryGet(name, 1, boundary_value, | 
| 441 boundary_value + 1, base::HistogramBase::kUmaTargetedHistogramFlag); | 442 boundary_value + 1, base::HistogramBase::kUmaTargetedHistogramFlag); | 
| 442 DCHECK_EQ(name, counter->histogram_name()); | 443 DCHECK_EQ(name, counter->histogram_name()); | 
| 443 counter->Add(sample); | 444 counter->Add(sample); | 
| 444 } | 445 } | 
| 445 | 446 | 
| 447 void WebKitPlatformSupportImpl::histogramSparse(const char* name, int sample) { | |
| 448 UMA_HISTOGRAM_SPARSE_SLOWLY(name, sample); | |
| 
jar (doing other things)
2013/07/19 17:55:28
nit: This works perfectly... but it scared me, sin
 
ajuma
2013/07/19 18:37:21
Done.
 | |
| 449 } | |
| 450 | |
| 446 const unsigned char* WebKitPlatformSupportImpl::getTraceCategoryEnabledFlag( | 451 const unsigned char* WebKitPlatformSupportImpl::getTraceCategoryEnabledFlag( | 
| 447 const char* category_group) { | 452 const char* category_group) { | 
| 448 return TRACE_EVENT_API_GET_CATEGORY_GROUP_ENABLED(category_group); | 453 return TRACE_EVENT_API_GET_CATEGORY_GROUP_ENABLED(category_group); | 
| 449 } | 454 } | 
| 450 | 455 | 
| 451 long* WebKitPlatformSupportImpl::getTraceSamplingState( | 456 long* WebKitPlatformSupportImpl::getTraceSamplingState( | 
| 452 const unsigned thread_bucket) { | 457 const unsigned thread_bucket) { | 
| 453 // Not supported in split-dll build. http://crbug.com/237249 | 458 // Not supported in split-dll build. http://crbug.com/237249 | 
| 454 #if !defined(CHROME_SPLIT_DLL) | 459 #if !defined(CHROME_SPLIT_DLL) | 
| 455 switch (thread_bucket) { | 460 switch (thread_bucket) { | 
| (...skipping 428 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 884 if (--shared_timer_suspended_ == 0 && | 889 if (--shared_timer_suspended_ == 0 && | 
| 885 (!shared_timer_.IsRunning() || | 890 (!shared_timer_.IsRunning() || | 
| 886 shared_timer_fire_time_was_set_while_suspended_)) { | 891 shared_timer_fire_time_was_set_while_suspended_)) { | 
| 887 shared_timer_fire_time_was_set_while_suspended_ = false; | 892 shared_timer_fire_time_was_set_while_suspended_ = false; | 
| 888 setSharedTimerFireInterval( | 893 setSharedTimerFireInterval( | 
| 889 shared_timer_fire_time_ - monotonicallyIncreasingTime()); | 894 shared_timer_fire_time_ - monotonicallyIncreasingTime()); | 
| 890 } | 895 } | 
| 891 } | 896 } | 
| 892 | 897 | 
| 893 } // namespace webkit_glue | 898 } // namespace webkit_glue | 
| OLD | NEW |