1 /* 2 * Copyright (C) 2015 The Android Open Source Project 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 17 #ifndef METRICS_C_METRICS_LIBRARY_H_ 18 #define METRICS_C_METRICS_LIBRARY_H_ 19 20 #if defined(__cplusplus) 21 extern "C" { 22 #endif 23 typedef struct CMetricsLibraryOpaque* CMetricsLibrary; 24 25 // C wrapper for MetricsLibrary::MetricsLibrary. 26 CMetricsLibrary CMetricsLibraryNew(void); 27 28 // C wrapper for MetricsLibrary::~MetricsLibrary. 29 void CMetricsLibraryDelete(CMetricsLibrary handle); 30 31 // C wrapper for MetricsLibrary::Init. 32 void CMetricsLibraryInit(CMetricsLibrary handle); 33 34 // C wrapper for MetricsLibrary::SendToUMA. 35 int CMetricsLibrarySendToUMA(CMetricsLibrary handle, 36 const char* name, int sample, 37 int min, int max, int nbuckets); 38 39 // C wrapper for MetricsLibrary::SendEnumToUMA. 40 int CMetricsLibrarySendEnumToUMA(CMetricsLibrary handle, 41 const char* name, int sample, int max); 42 43 // C wrapper for MetricsLibrary::SendSparseToUMA. 44 int CMetricsLibrarySendSparseToUMA(CMetricsLibrary handle, 45 const char* name, int sample); 46 47 // C wrapper for MetricsLibrary::SendCrashToUMA. 48 int CMetricsLibrarySendCrashToUMA(CMetricsLibrary handle, 49 const char* crash_kind); 50 51 // C wrapper for MetricsLibrary::AreMetricsEnabled. 52 int CMetricsLibraryAreMetricsEnabled(CMetricsLibrary handle); 53 54 #if defined(__cplusplus) 55 } 56 #endif 57 #endif // METRICS_C_METRICS_LIBRARY_H_ 58