OLD | NEW |
(Empty) | |
| 1 // Copyright (c) 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 BASE_METRICS_HISTOGRAM_SAMPLE_CHROMEOS_H |
| 6 #define BASE_METRICS_HISTOGRAM_SAMPLE_CHROMEOS_H |
| 7 |
| 8 #include <string> |
| 9 |
| 10 #include "base/base_export.h" |
| 11 #include "base/compiler_specific.h" |
| 12 #include "base/metrics/metric_sample_chromeos.h" |
| 13 |
| 14 namespace base { |
| 15 // Represents a single histogram sample. |
| 16 // This class is meant to be used to serialize and deserialize samples to send |
| 17 // them from chrome OS to chrome. |
| 18 class BASE_EXPORT HistogramSample : public MetricSample { |
| 19 public: |
| 20 HistogramSample(const std::string& name, |
| 21 int sample, |
| 22 int min, |
| 23 int max, |
| 24 int nbucket); |
| 25 virtual ~HistogramSample(); |
| 26 |
| 27 int sample() const; |
| 28 int min() const; |
| 29 int max() const; |
| 30 int nbucket() const; |
| 31 // Returns the sample serialized on the format: |
| 32 // histogram\0|name_| |sample_| |min_| |max_| |nbucket_|\0 |
| 33 virtual string ToString() const OVERRIDE; |
| 34 |
| 35 // static |
| 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 int max_, min_, sample_, nbucket_; |
| 44 }; |
| 45 } // namespace base |
| 46 #endif // BASE_METRICS_HISTOGRAM_SAMPLE_CHROMEOS_H |
OLD | NEW |