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

Side by Side Diff: README

Issue 2819008: Update the README to mention that a C API is also available. (Closed) Base URL: ssh://git@chromiumos-git/metrics.git
Patch Set: Remove old metric. Created 10 years, 6 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 | « no previous file | no next file » | 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 ================================================================================
11 The Metrics Library: libmetrics 11 The Metrics Library: libmetrics
12 ================================================================================ 12 ================================================================================
13 13
14 libmetrics is a small library that implements the basic C++ API for 14 libmetrics is a small library that implements the basic C and C++ API
15 metrics collection. All metrics collection is funneled through this 15 for metrics collection. All metrics collection is funneled through
16 library. The easiest and recommended way for a client-side module to 16 this library. The easiest and recommended way for a client-side module
17 collect user metrics is to link libmetrics and use its APIs to send 17 to collect user metrics is to link libmetrics and use its APIs to send
18 metrics to Chrome for transport to UMA. In order to use the library in 18 metrics to Chrome for transport to UMA. In order to use the library in
19 a module, you need to do the following: 19 a module, you need to do the following:
20 20
21 - Add a dependence (DEPEND and RDEPEND) on chromeos-base/metrics to 21 - Add a dependence (DEPEND and RDEPEND) on chromeos-base/metrics to
22 the module's ebuild. 22 the module's ebuild.
23 23
24 - Link the module with libmetrics (for example, by passing -lmetrics 24 - Link the module with libmetrics (for example, by passing -lmetrics
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
(...skipping 12 matching lines...) Expand all
40 40
41 bool MetricsLibrary::SendEnumToUMA(const std::string& name, int sample, 41 bool MetricsLibrary::SendEnumToUMA(const std::string& name, int sample,
42 int max) 42 int max)
43 sends a sample for an enumeration (linear) histogram. 43 sends a sample for an enumeration (linear) histogram.
44 44
45 Before using these methods, a MetricsLibrary object needs to be 45 Before using these methods, a MetricsLibrary object needs to be
46 constructed and initialized through its Init method. See the 46 constructed and initialized through its Init method. See the
47 complete API documentation in metrics_library.h under 47 complete API documentation in metrics_library.h under
48 src/platform/metrics/. 48 src/platform/metrics/.
49 49
50 For more information on the C API see c_metrics_library.h.
51
50 - On the target platform, shortly after the sample is sent it should 52 - On the target platform, shortly after the sample is sent it should
51 be visible in Chrome through "about:histograms". 53 be visible in Chrome through "about:histograms".
52 54
53 55
54 ================================================================================ 56 ================================================================================
55 Histogram Naming Convention 57 Histogram Naming Convention
56 ================================================================================ 58 ================================================================================
57 59
58 Use TrackerArea.MetricName. For example: 60 Use TrackerArea.MetricName. For example:
59 61
60 Logging.CrashCounter 62 Logging.CrashCounter
61 Network.TimeToDrop 63 Network.TimeToDrop
62 Platform.BootTime
63 64
64 65
65 ================================================================================ 66 ================================================================================
66 Server Side 67 Server Side
67 ================================================================================ 68 ================================================================================
68 69
69 If the histogram data is visible in about:histograms, it will be sent 70 If the histogram data is visible in about:histograms, it will be sent
70 by an official Chrome build to UMA, assuming the user has opted into 71 by an official Chrome build to UMA, assuming the user has opted into
71 metrics collection. To make the histogram visible on 72 metrics collection. To make the histogram visible on
72 "chromedashboard", the histogram wiki needs to be updated (steps 2 and 73 "chromedashboard", the histogram wiki needs to be updated (steps 2 and
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
108 screen saver states to determine if the user is actively using the 109 screen saver states to determine if the user is actively using the
109 device or not and generates the corresponding data. The metrics daemon 110 device or not and generates the corresponding data. The metrics daemon
110 uses libmetrics to send the data to Chrome. 111 uses libmetrics to send the data to Chrome.
111 112
112 The recommended way to generate metrics data from a module is to link 113 The recommended way to generate metrics data from a module is to link
113 and use libmetrics directly. However, the module could instead send 114 and use libmetrics directly. However, the module could instead send
114 signals to or communicate in some alternative way with the metrics 115 signals to or communicate in some alternative way with the metrics
115 daemon. Then the metrics daemon needs to monitor for the relevant 116 daemon. Then the metrics daemon needs to monitor for the relevant
116 events and take appropriate action -- for example, aggregate data and 117 events and take appropriate action -- for example, aggregate data and
117 send the histogram samples. 118 send the histogram samples.
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698