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

Side by Side Diff: metrics_library.h

Issue 2832008: add C wrapper for libmetrics (Closed) Base URL: ssh://git@chromiumos-git//metrics.git
Patch Set: remove include 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
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 #ifndef METRICS_LIBRARY_H_ 5 #ifndef METRICS_LIBRARY_H_
6 #define METRICS_LIBRARY_H_ 6 #define METRICS_LIBRARY_H_
7 7
8 #include <sys/types.h> 8 #include <sys/types.h>
9 #include <string> 9 #include <string>
10 10
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
49 // |sample| is the sample value to be recorded (1 <= |sample| < |max|). 49 // |sample| is the sample value to be recorded (1 <= |sample| < |max|).
50 // |max| is the maximum value of the histogram samples. 50 // |max| is the maximum value of the histogram samples.
51 // 0 is the implicit underflow bucket. 51 // 0 is the implicit underflow bucket.
52 // [|max|,infinity) is the implicit overflow bucket. 52 // [|max|,infinity) is the implicit overflow bucket.
53 bool SendEnumToUMA(const std::string& name, int sample, int max); 53 bool SendEnumToUMA(const std::string& name, int sample, int max);
54 54
55 // Sends to Autotest and returns true on success. 55 // Sends to Autotest and returns true on success.
56 static bool SendToAutotest(const std::string& name, int value); 56 static bool SendToAutotest(const std::string& name, int value);
57 57
58 private: 58 private:
59 friend class CMetricsLibraryTest;
59 friend class MetricsLibraryTest; 60 friend class MetricsLibraryTest;
60 FRIEND_TEST(MetricsLibraryTest, FormatChromeMessage); 61 FRIEND_TEST(MetricsLibraryTest, FormatChromeMessage);
61 FRIEND_TEST(MetricsLibraryTest, FormatChromeMessageTooLong); 62 FRIEND_TEST(MetricsLibraryTest, FormatChromeMessageTooLong);
62 FRIEND_TEST(MetricsLibraryTest, SendMessageToChrome); 63 FRIEND_TEST(MetricsLibraryTest, SendMessageToChrome);
63 FRIEND_TEST(MetricsLibraryTest, SendMessageToChromeUMAEventsBadFileLocation); 64 FRIEND_TEST(MetricsLibraryTest, SendMessageToChromeUMAEventsBadFileLocation);
64 65
65 // Sends message of size |length| to Chrome for transport to UMA and 66 // Sends message of size |length| to Chrome for transport to UMA and
66 // returns true on success. 67 // returns true on success.
67 bool SendMessageToChrome(int32_t length, const char* message); 68 bool SendMessageToChrome(int32_t length, const char* message);
68 69
69 // Formats a name/value message for Chrome in |buffer| and returns the 70 // Formats a name/value message for Chrome in |buffer| and returns the
70 // length of the message or a negative value on error. 71 // length of the message or a negative value on error.
71 // 72 //
72 // Message format is: | LENGTH(binary) | NAME | \0 | VALUE | \0 | 73 // Message format is: | LENGTH(binary) | NAME | \0 | VALUE | \0 |
73 // 74 //
74 // The arbitrary |format| argument covers the non-LENGTH portion of the 75 // The arbitrary |format| argument covers the non-LENGTH portion of the
75 // message. The caller is responsible to store the \0 character 76 // message. The caller is responsible to store the \0 character
76 // between NAME and VALUE (e.g. "%s%c%d", name, '\0', value). 77 // between NAME and VALUE (e.g. "%s%c%d", name, '\0', value).
77 int32_t FormatChromeMessage(int32_t buffer_size, char* buffer, 78 int32_t FormatChromeMessage(int32_t buffer_size, char* buffer,
78 const char* format, ...); 79 const char* format, ...);
79 80
80 const char* uma_events_file_; 81 const char* uma_events_file_;
81 }; 82 };
82 83
83 #endif // METRICS_LIBRARY_H_ 84 #endif // METRICS_LIBRARY_H_
OLDNEW
« c_metrics_library.h ('K') | « c_metrics_library.cc ('k') | metrics_library_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698