Commit e24a853b authored by zelidrag@chromium.org's avatar zelidrag@chromium.org

Added check for invalid histogram data, added additional diagnostics to find...

Added check for invalid histogram data, added additional diagnostics to find the source of troubles on ChromeOS.

BUG=140301
TEST=none


Review URL: https://chromiumcodereview.appspot.com/10825169

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@149797 0039d316-1c4b-4281-b951-d872f2087c98
parent d07204a6
......@@ -34,6 +34,17 @@ namespace chromeos {
// The interval between external metrics collections in seconds
static const int kExternalMetricsCollectionIntervalSeconds = 30;
class SystemHistogram : public base::Histogram {
public:
static bool CheckValues(const std::string& name,
int minimum,
int maximum,
size_t bucket_count) {
return base::Histogram::InspectConstructionArguments(
name, &minimum, &maximum, &bucket_count);
}
};
ExternalMetrics::ExternalMetrics()
: test_recorder_(NULL) {
}
......@@ -89,6 +100,14 @@ void ExternalMetrics::RecordHistogram(const char* histogram_data) {
LOG(ERROR) << "bad histogram request: " << histogram_data;
return;
}
if (!SystemHistogram::CheckValues(name, min, max, nbuckets)) {
LOG(ERROR) << "Invalid histogram " << name
<< ", min=" << min
<< ", max=" << max
<< ", nbuckets=" << nbuckets;
return;
}
// Do not use the UMA_HISTOGRAM_... macros here. They cache the Histogram
// instance and thus only work if |name| is constant.
base::Histogram* counter = base::Histogram::FactoryGet(
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment