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

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

Issue 10865002: Revert 150969 - Disable getting histogram data from child processes other than the renderer process… (Closed) Base URL: svn://svn.chromium.org/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"
9 #include "base/metrics/statistics_recorder.h" 7 #include "base/metrics/statistics_recorder.h"
10 #include "base/string_util.h"
11 8
12 using base::Histogram; 9 using base::Histogram;
13 using base::StatisticsRecorder; 10 using base::StatisticsRecorder;
14 11
15 namespace base { 12 namespace base {
16 13
17 HistogramSnapshotManager::HistogramSnapshotManager( 14 HistogramSnapshotManager::HistogramSnapshotManager(
18 HistogramFlattener* histogram_flattener) 15 HistogramFlattener* histogram_flattener)
19 : histogram_flattener_(histogram_flattener) { 16 : histogram_flattener_(histogram_flattener) {
20 DCHECK(histogram_flattener_); 17 DCHECK(histogram_flattener_);
(...skipping 19 matching lines...) Expand all
40 void HistogramSnapshotManager::PrepareDelta(const Histogram& histogram) { 37 void HistogramSnapshotManager::PrepareDelta(const Histogram& histogram) {
41 DCHECK(histogram_flattener_); 38 DCHECK(histogram_flattener_);
42 39
43 // Get up-to-date snapshot of sample stats. 40 // Get up-to-date snapshot of sample stats.
44 Histogram::SampleSet snapshot; 41 Histogram::SampleSet snapshot;
45 histogram.SnapshotSample(&snapshot); 42 histogram.SnapshotSample(&snapshot);
46 const std::string& histogram_name = histogram.histogram_name(); 43 const std::string& histogram_name = histogram.histogram_name();
47 44
48 int corruption = histogram.FindCorruption(snapshot); 45 int corruption = histogram.FindCorruption(snapshot);
49 46
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
56 // Crash if we detect that our histograms have been overwritten. This may be 47 // Crash if we detect that our histograms have been overwritten. This may be
57 // a fair distance from the memory smasher, but we hope to correlate these 48 // a fair distance from the memory smasher, but we hope to correlate these
58 // crashes with other events, such as plugins, or usage patterns, etc. 49 // crashes with other events, such as plugins, or usage patterns, etc.
59 if (Histogram::BUCKET_ORDER_ERROR & corruption) { 50 if (Histogram::BUCKET_ORDER_ERROR & corruption) {
60 // The checksum should have caught this, so crash separately if it didn't. 51 // The checksum should have caught this, so crash separately if it didn't.
61 CHECK_NE(0, Histogram::RANGE_CHECKSUM_ERROR & corruption); 52 CHECK_NE(0, Histogram::RANGE_CHECKSUM_ERROR & corruption);
62 CHECK(false); // Crash for the bucket order corruption. 53 CHECK(false); // Crash for the bucket order corruption.
63 } 54 }
64 // Checksum corruption might not have caused order corruption. 55 // Checksum corruption might not have caused order corruption.
65 CHECK_EQ(0, Histogram::RANGE_CHECKSUM_ERROR & corruption); 56 CHECK_EQ(0, Histogram::RANGE_CHECKSUM_ERROR & corruption);
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
107 } 98 }
108 99
109 // Snapshot now contains only a delta to what we've already_logged. 100 // Snapshot now contains only a delta to what we've already_logged.
110 if (snapshot.redundant_count() > 0) { 101 if (snapshot.redundant_count() > 0) {
111 histogram_flattener_->RecordDelta(histogram, snapshot); 102 histogram_flattener_->RecordDelta(histogram, snapshot);
112 // Add new data into our running total. 103 // Add new data into our running total.
113 already_logged->Add(snapshot); 104 already_logged->Add(snapshot);
114 } 105 }
115 } 106 }
116 } // namespace base 107 } // 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