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

Side by Side Diff: src/platform/metrics/README

Issue 2049007: Start transition the metrics library to non-static API. Use gmock in tests. (Closed) Base URL: ssh://git@chromiumos-git/chromeos
Patch Set: Break down tests to avoid explicit metrics lib mock checkpoints. Created 10 years, 7 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
« no previous file with comments | « src/platform/metrics/Makefile ('k') | src/platform/metrics/metrics_daemon.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 Copyright (c) 2010 The Chromium OS Authors. All rights reserved. 1 Copyright (c) 2010 The Chromium OS Authors. All rights reserved.
2 Use of this source code is governed by a BSD-style license that can be 2 Use of this source code is governed by a BSD-style license that can be
3 found in the LICENSE file. 3 found in the LICENSE file.
4 4
5 The Chrome OS "metrics" package contains utilities for client-side 5 The Chrome OS "metrics" package contains utilities for client-side
6 user metric collection. The collected data is sent to Chrome for 6 user metric collection. The collected data is sent to Chrome for
7 transport to the UMA server. 7 transport to the UMA server.
8 8
9 9
10 ================================================================================ 10 ================================================================================
(...skipping 14 matching lines...) Expand all
25 to the module's link command). Both libmetrics.so and libmetrics.a 25 to the module's link command). Both libmetrics.so and libmetrics.a
26 are built and installed under $SYSROOT/usr/lib/. Note that by 26 are built and installed under $SYSROOT/usr/lib/. Note that by
27 default -lmetrics will link against libmetrics.so, which is 27 default -lmetrics will link against libmetrics.so, which is
28 preferred. 28 preferred.
29 29
30 - To access the metrics library API in the module, include the 30 - To access the metrics library API in the module, include the
31 <metrics_library.h> header file. The file is installed in 31 <metrics_library.h> header file. The file is installed in
32 $SYSROOT/usr/include/ when the metrics library is built and 32 $SYSROOT/usr/include/ when the metrics library is built and
33 installed. 33 installed.
34 34
35 - Currently, the API includes two static methods: 35 - The API includes two methods:
36
37 bool MetricsLibrary::SendToUMA(const std::string& name, int sample,
38 int min, int max, int nbuckets)
39 sends a sample for a regular (exponential) histogram.
40
41 bool MetricsLibrary::SendEnumToUMA(const std::string& name, int sample,
42 int max)
43 sends a sample for an enumeration (linear) histogram.
44
45 Currently, the API also includes two deprecated static methods:
36 46
37 bool MetricsLibrary::SendToChrome(const std::string& name, int sample, 47 bool MetricsLibrary::SendToChrome(const std::string& name, int sample,
38 int min, int max, int nbuckets) 48 int min, int max, int nbuckets)
39 sends a sample for a regular (exponential) histogram.
40
41 bool MetricsLibrary::SendEnumToChrome(const std::string& name, int sample, 49 bool MetricsLibrary::SendEnumToChrome(const std::string& name, int sample,
42 int max) 50 int max)
43 sends a sample for an enumeration (linear) histogram.
44 51
45 See API documentation in metrics_library.h under 52 See the API documentation in metrics_library.h under
46 src/platform/metrics/. 53 src/platform/metrics/.
47 54
48 TODO: It might be better to convert the API to a dynamic object.
49
50 - On the target platform, shortly after the sample is sent it should 55 - On the target platform, shortly after the sample is sent it should
51 be visible in Chrome through "about:histograms". 56 be visible in Chrome through "about:histograms".
52 57
53 58
54 ================================================================================ 59 ================================================================================
55 Histogram Naming Convention 60 Histogram Naming Convention
56 ================================================================================ 61 ================================================================================
57 62
58 Use TrackerArea.MetricName. For example: 63 Use TrackerArea.MetricName. For example:
59 64
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
106 screen saver states to determine if the user is actively using the 111 screen saver states to determine if the user is actively using the
107 device or not and generates the corresponding data. The metrics daemon 112 device or not and generates the corresponding data. The metrics daemon
108 uses libmetrics to send the data to Chrome. 113 uses libmetrics to send the data to Chrome.
109 114
110 The recommended way to generate metrics data from a module is to link 115 The recommended way to generate metrics data from a module is to link
111 and use libmetrics directly. However, the module could instead send 116 and use libmetrics directly. However, the module could instead send
112 signals to or communicate in some alternative way with the metrics 117 signals to or communicate in some alternative way with the metrics
113 daemon. Then the metrics daemon needs to monitor for the relevant 118 daemon. Then the metrics daemon needs to monitor for the relevant
114 events and take appropriate action -- for example, aggregate data and 119 events and take appropriate action -- for example, aggregate data and
115 send the histogram samples. 120 send the histogram samples.
OLDNEW
« no previous file with comments | « src/platform/metrics/Makefile ('k') | src/platform/metrics/metrics_daemon.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698