Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(274)

Side by Side Diff: base/metrics/histogram_snapshot_manager.cc

Issue 10831247: Disable getting histogram data from child processes. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 8 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | content/browser/histogram_controller.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 "base/metrics/histogram_snapshot_manager.h" 5 #include "base/metrics/histogram_snapshot_manager.h"
6 6
7 #include "base/compiler_specific.h"
8 #include "base/debug/alias.h"
7 #include "base/metrics/statistics_recorder.h" 9 #include "base/metrics/statistics_recorder.h"
10 #include "base/string_util.h"
8 11
9 using base::Histogram; 12 using base::Histogram;
10 using base::StatisticsRecorder; 13 using base::StatisticsRecorder;
11 14
12 namespace base { 15 namespace base {
13 16
14 HistogramSnapshotManager::HistogramSnapshotManager( 17 HistogramSnapshotManager::HistogramSnapshotManager(
15 HistogramFlattener* histogram_flattener) 18 HistogramFlattener* histogram_flattener)
16 : histogram_flattener_(histogram_flattener) { 19 : histogram_flattener_(histogram_flattener) {
17 DCHECK(histogram_flattener_); 20 DCHECK(histogram_flattener_);
(...skipping 19 matching lines...) Expand all
37 void HistogramSnapshotManager::PrepareDelta(const Histogram& histogram) { 40 void HistogramSnapshotManager::PrepareDelta(const Histogram& histogram) {
38 DCHECK(histogram_flattener_); 41 DCHECK(histogram_flattener_);
39 42
40 // Get up-to-date snapshot of sample stats. 43 // Get up-to-date snapshot of sample stats.
41 Histogram::SampleSet snapshot; 44 Histogram::SampleSet snapshot;
42 histogram.SnapshotSample(&snapshot); 45 histogram.SnapshotSample(&snapshot);
43 const std::string& histogram_name = histogram.histogram_name(); 46 const std::string& histogram_name = histogram.histogram_name();
44 47
45 int corruption = histogram.FindCorruption(snapshot); 48 int corruption = histogram.FindCorruption(snapshot);
46 49
50 char histogram_name_buf[128];
51 base::strlcpy(histogram_name_buf,
52 histogram_name.c_str(),
53 arraysize(histogram_name_buf));
54 base::debug::Alias(histogram_name_buf);
55
47 // Crash if we detect that our histograms have been overwritten. This may be 56 // Crash if we detect that our histograms have been overwritten. This may be
48 // a fair distance from the memory smasher, but we hope to correlate these 57 // a fair distance from the memory smasher, but we hope to correlate these
49 // crashes with other events, such as plugins, or usage patterns, etc. 58 // crashes with other events, such as plugins, or usage patterns, etc.
50 if (Histogram::BUCKET_ORDER_ERROR & corruption) { 59 if (Histogram::BUCKET_ORDER_ERROR & corruption) {
51 // The checksum should have caught this, so crash separately if it didn't. 60 // The checksum should have caught this, so crash separately if it didn't.
52 CHECK_NE(0, Histogram::RANGE_CHECKSUM_ERROR & corruption); 61 CHECK_NE(0, Histogram::RANGE_CHECKSUM_ERROR & corruption);
53 CHECK(false); // Crash for the bucket order corruption. 62 CHECK(false); // Crash for the bucket order corruption.
54 } 63 }
55 // Checksum corruption might not have caused order corruption. 64 // Checksum corruption might not have caused order corruption.
56 CHECK_EQ(0, Histogram::RANGE_CHECKSUM_ERROR & corruption); 65 CHECK_EQ(0, Histogram::RANGE_CHECKSUM_ERROR & corruption);
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
98 } 107 }
99 108
100 // Snapshot now contains only a delta to what we've already_logged. 109 // Snapshot now contains only a delta to what we've already_logged.
101 if (snapshot.redundant_count() > 0) { 110 if (snapshot.redundant_count() > 0) {
102 histogram_flattener_->RecordDelta(histogram, snapshot); 111 histogram_flattener_->RecordDelta(histogram, snapshot);
103 // Add new data into our running total. 112 // Add new data into our running total.
104 already_logged->Add(snapshot); 113 already_logged->Add(snapshot);
105 } 114 }
106 } 115 }
107 } // namespace base 116 } // namespace base
OLDNEW
« no previous file with comments | « no previous file | content/browser/histogram_controller.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698