Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | |
| 2 // Use of this source code is governed by a BSD-style license that can be | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #ifndef COMPONENTS_METRICS_HISTOGRAM_SAMPLE_CHROMEOS_H | |
| 6 #define COMPONENTS_METRICS_HISTOGRAM_SAMPLE_CHROMEOS_H | |
| 7 | |
| 8 #include <string> | |
| 9 | |
| 10 #include "base/base_export.h" | |
| 11 #include "base/compiler_specific.h" | |
| 12 #include "components/metrics/metric_sample_chromeos.h" | |
| 13 | |
| 14 namespace metrics { | |
| 15 | |
| 16 // Represents a single histogram sample. | |
| 17 // This class is meant to be used to serialize and deserialize samples to send | |
| 18 // them from chrome OS to chrome. | |
| 19 class BASE_EXPORT HistogramSample : public MetricSample { | |
| 20 public: | |
| 21 HistogramSample(const std::string& name, | |
| 22 int sample, | |
| 23 int min, | |
| 24 int max, | |
| 25 int nbucket); | |
| 26 virtual ~HistogramSample(); | |
| 27 | |
| 28 int sample() const { return sample_; } | |
| 29 int min() const { return min_; } | |
| 30 int max() const { return max_; } | |
| 31 int nbucket() const { return nbucket_; } | |
| 32 // Returns the sample serialized on the format: | |
|
Ben Chan
2014/04/18 20:27:08
nit: add a line break
| |
| 33 // histogram\0|name_| |sample_| |min_| |max_| |nbucket_|\0 | |
| 34 virtual std::string ToString() const OVERRIDE; | |
| 35 | |
| 36 // Deserialize a histogram passed as a string. | |
| 37 // Returns a HistogramSample if the deserialization is successful, otherwise | |
| 38 // returns NULL. | |
| 39 static HistogramSample* ReadHistogram( | |
| 40 const std::string& serialized_histogram); | |
| 41 | |
| 42 private: | |
| 43 const int max_, min_, sample_, nbucket_; | |
| 44 | |
| 45 DISALLOW_COPY_AND_ASSIGN(HistogramSample); | |
| 46 }; | |
| 47 | |
| 48 } // namespace metrics | |
| 49 | |
| 50 #endif // COMPONENTS_METRICS_HISTOGRAM_SAMPLE_CHROMEOS_H | |
| OLD | NEW |