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

Side by Side Diff: base/metrics/metrics_utils_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_METRICS_UTILS_CHROMEOS_H_
6 #define BASE_METRICS_METRICS_UTILS_CHROMEOS_H_
7
8 #include "base/base_export.h"
9 #include "base/memory/scoped_vector.h"
10
11 namespace base {
12 class MetricSample;
13
14 // Contains metrics helpers to serialize and deserialize metrics collected by
15 // chrome os.
16 namespace MetricsUtils {
17 // Deserialize a sample passed as a string and return a sample.
18 // The return value will either be a subclass of MetricSample or NULL if the
19 // sample could not be parsed.
20 BASE_EXPORT MetricSample* ReadSample(const std::string& sample);
21
22 // Read all samples from a file and truncate the file when done.
23 BASE_EXPORT void ReadAndTruncateMetricsFromFile(
24 const std::string& filename,
25 ScopedVector<MetricSample>* metrics);
26
27 // Serialize a metric and write it to filename.
28 // The format for the message wrote is:
29 // message_size, serialized_message
30 // where
31 // * message_size is the total length of the message (message_size +
32 // serialized_message) on 4 bytes
33 // * serialized_message is the serialized version of sample (using ToString)
34 BASE_EXPORT bool WriteMetricToFile(const MetricSample& sample,
35 const std::string& filename);
36
37 // Maximum length of a serialized message
38 const int kMessageMaxLength = 1024;
39 } // namespace MetricsUtils
40 } // namespace base
41 #endif // BASE_METRICS_METRICS_UTILS_CHROMEOS_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698