1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
|
/* Copyright (c) 2013 The Chromium OS Authors. All rights reserved.
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
#include <stdio.h>
#include <syslog.h>
#include <unistd.h>
#ifdef HAVE_LIB_METRICS
#include <metrics/c_metrics_library.h>
void cras_metrics_log_event(const char *event)
{
CMetricsLibrary handle;
syslog(LOG_DEBUG, "UMA event: %s", event);
handle = CMetricsLibraryNew();
CMetricsLibraryInit(handle);
CMetricsLibrarySendCrosEventToUMA(handle, event);
CMetricsLibraryDelete(handle);
}
void cras_metrics_log_histogram(const char *name, int sample, int min,
int max, int nbuckets)
{
CMetricsLibrary handle;
syslog(LOG_DEBUG, "UMA name: %s", name);
handle = CMetricsLibraryNew();
CMetricsLibraryInit(handle);
CMetricsLibrarySendToUMA(handle, name, sample, min, max, nbuckets);
CMetricsLibraryDelete(handle);
}
void cras_metrics_log_sparse_histogram(const char *name, int sample)
{
CMetricsLibrary handle;
syslog(LOG_DEBUG, "UMA name: %s", name);
handle = CMetricsLibraryNew();
CMetricsLibraryInit(handle);
CMetricsLibrarySendSparseToUMA(handle, name, sample);
CMetricsLibraryDelete(handle);
}
#else
void cras_metrics_log_event(const char *event)
{
}
void cras_metrics_log_histogram(const char *name, int sample, int min,
int max, int nbuckets)
{
}
void cras_metrics_log_enum_histogram(const char *name, int sample, int max)
{
}
void cras_metrics_log_sparse_histogram(const char *name, int sample)
{
}
#endif
|