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

Side by Side Diff: base/metrics/metric_sample_chromeos.h

Issue 227873002: Create a histogram serialization mechanism in components/metrics (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fixing clang complains about override keyword. Created 6 years, 8 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
OLDNEW
(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_METRIC_SAMPLE_CHROMEOS_H_
6 #define BASE_METRICS_METRIC_SAMPLE_CHROMEOS_H_
7
8 #include <string>
9
10 #include "base/base_export.h"
11
12 using std::string;
achaulk 2014/04/17 16:45:18 I think the general rule is no using declarations
13
14 namespace base {
15 // Abstract class representing a metric sample (single measures).
16 // This class and its subclasses are used by libmetrics (ChromeOS) to serialize
17 // and deserialize measurements to send them to a metrics sending service.
18 // It is meant to be a simple container with serialization functions.
19 class BASE_EXPORT MetricSample {
20 public:
21 // Types of metric sample used.
22 enum SampleType {
23 CRASH,
24 HISTOGRAM,
25 LINEAR_HISTOGRAM,
26 SPARSE_HISTOGRAM,
27 USER_ACTION
28 };
29 explicit MetricSample(SampleType t, string metric_name);
Alexei Svitkine (slow) 2014/04/17 16:33:21 Use a better name than |t|. Make |metric_name| a c
30 virtual ~MetricSample();
31
32 // Returns true if the sample is valid (can be serialized without ambiguity).
33 //
34 // This function should be used to filter bad samples before serializing them
35 // to disk.
36 virtual bool IsValid() const;
37 SampleType type() const;
Alexei Svitkine (slow) 2014/04/17 16:33:21 For trivial successors, you can inline them in the
Alexei Svitkine (slow) 2014/04/17 16:39:40 *accessors
38 string name() const;
39
40 // Returns a serialized version of the sample.
41 //
42 // This function should be overriden by subclasses to define their own
43 // serialization format.
44 // The general serialized message is:
45 // |sampletype|,\0,<sample type specific serialized data>,\0
46 //
47 // The format is akward but it is implemented independently in both chrome os
48 // and chrome. We will keep it for now.
49 virtual string ToString() const;
50
51 protected:
Alexei Svitkine (slow) 2014/04/17 16:33:21 Do these need to be protected or can they be priva
52 SampleType type_;
53 string name_;
54 };
55 } // namespace base
56 #endif // BASE_METRICS_METRIC_SAMPLE_CHROMEOS_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698