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

Side by Side Diff: c_metrics_library.cc

Issue 3171023: Add weekly crash counters, refactor metrics_daemon, respect opt-in in library. (Closed) Base URL: http://src.chromium.org/git/metrics.git
Patch Set: Respond to review Created 10 years, 4 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 | « c_metrics_library.h ('k') | counter.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 // 5 //
6 // C wrapper to libmetrics 6 // C wrapper to libmetrics
7 // 7 //
8 8
9 #include "c_metrics_library.h" 9 #include "c_metrics_library.h"
10 #include "metrics_library.h" 10 #include "metrics_library.h"
11 11
12 extern "C" CMetricsLibrary CMetricsLibraryNew(void) { 12 extern "C" CMetricsLibrary CMetricsLibraryNew(void) {
13 MetricsLibrary* lib = new MetricsLibrary; 13 MetricsLibrary* lib = new MetricsLibrary;
14 return reinterpret_cast<CMetricsLibrary>(lib); 14 return reinterpret_cast<CMetricsLibrary>(lib);
15 } 15 }
16 16
17 extern "C" void CMetricsLibraryDelete(CMetricsLibrary handle) { 17 extern "C" void CMetricsLibraryDelete(CMetricsLibrary handle) {
18 MetricsLibrary* lib = reinterpret_cast<MetricsLibrary*>(handle); 18 MetricsLibrary* lib = reinterpret_cast<MetricsLibrary*>(handle);
19 delete lib; 19 delete lib;
20 } 20 }
21 21
22 extern "C" void CMetricsLibraryInit(CMetricsLibrary handle) { 22 extern "C" void CMetricsLibraryInit(CMetricsLibrary handle) {
23 MetricsLibrary* lib = reinterpret_cast<MetricsLibrary*>(handle); 23 MetricsLibrary* lib = reinterpret_cast<MetricsLibrary*>(handle);
24 if (lib != NULL) 24 if (lib != NULL)
25 lib->Init(); 25 lib->Init();
26 } 26 }
27 27
28 extern "C" int CMetricsLibrarySendToUMA(CMetricsLibrary handle, 28 extern "C" int CMetricsLibrarySendToUMA(CMetricsLibrary handle,
29 » » » » » const char* name, int sample, 29 const char* name, int sample,
30 » » » » » int min, int max, int nbuckets) { 30 int min, int max, int nbuckets) {
31 MetricsLibrary* lib = reinterpret_cast<MetricsLibrary*>(handle); 31 MetricsLibrary* lib = reinterpret_cast<MetricsLibrary*>(handle);
32 if (lib == NULL) 32 if (lib == NULL)
33 return 0; 33 return 0;
34 return lib->SendToUMA(std::string(name), sample, min, max, nbuckets); 34 return lib->SendToUMA(std::string(name), sample, min, max, nbuckets);
35 } 35 }
36 36
37 extern "C" int CMetricsLibrarySendEnumToUMA(CMetricsLibrary handle, 37 extern "C" int CMetricsLibrarySendEnumToUMA(CMetricsLibrary handle,
38 » » » » » const char* name, int sample, 38 const char* name, int sample,
39 » » » » » int max) { 39 int max) {
40 MetricsLibrary* lib = reinterpret_cast<MetricsLibrary*>(handle); 40 MetricsLibrary* lib = reinterpret_cast<MetricsLibrary*>(handle);
41 if (lib == NULL) 41 if (lib == NULL)
42 return 0; 42 return 0;
43 return lib->SendEnumToUMA(std::string(name), sample, max); 43 return lib->SendEnumToUMA(std::string(name), sample, max);
44 } 44 }
45
46 extern "C" int CMetricsLibraryAreMetricsEnabled(CMetricsLibrary handle) {
47 MetricsLibrary* lib = reinterpret_cast<MetricsLibrary*>(handle);
48 if (lib == NULL)
49 return 0;
50 return lib->AreMetricsEnabled();
51 }
OLDNEW
« no previous file with comments | « c_metrics_library.h ('k') | counter.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698