port metrics_logger to v2 format
Bug: 34450377 Test: manual, needs to be a cross-language test Change-Id: Ib89a48f2c52428deff863b0c28f3c10e7333c8a2
This commit is contained in:
parent
eebe07c539
commit
081492552c
3 changed files with 16 additions and 2 deletions
|
@ -22,7 +22,7 @@ cc_defaults {
|
|||
|
||||
// 524291 corresponds to sysui_histogram, from
|
||||
// frameworks/base/core/java/com/android/internal/logging/EventLogTags.logtags
|
||||
"-DHISTOGRAM_LOG_TAG=524291",
|
||||
"-DHISTOGRAM_LOG_TAG=524292",
|
||||
],
|
||||
}
|
||||
|
||||
|
|
|
@ -24,5 +24,14 @@ namespace metricslogger {
|
|||
// buffer.
|
||||
void LogHistogram(const std::string& event, int32_t data);
|
||||
|
||||
// TODO: replace these with the metric_logger.proto definitions
|
||||
enum {
|
||||
LOGBUILDER_CATEGORY = 757,
|
||||
LOGBUILDER_NAME = 799,
|
||||
LOGBUILDER_BUCKET = 801,
|
||||
LOGBUILDER_VALUE = 802,
|
||||
LOGBUILDER_HISTOGRAM = 804,
|
||||
};
|
||||
|
||||
} // namespace metricslogger
|
||||
} // namespace android
|
||||
|
|
|
@ -23,9 +23,14 @@
|
|||
namespace android {
|
||||
namespace metricslogger {
|
||||
|
||||
// Mirror com.android.internal.logging.MetricsLogger#histogram().
|
||||
void LogHistogram(const std::string& event, int32_t data) {
|
||||
android_log_event_list log(HISTOGRAM_LOG_TAG);
|
||||
log << event << data << LOG_ID_EVENTS;
|
||||
log << LOGBUILDER_CATEGORY << LOGBUILDER_HISTOGRAM
|
||||
<< LOGBUILDER_NAME << event
|
||||
<< LOGBUILDER_BUCKET << data
|
||||
<< LOGBUILDER_VALUE << 1
|
||||
<< LOG_ID_EVENTS;
|
||||
}
|
||||
|
||||
} // namespace metricslogger
|
||||
|
|
Loading…
Reference in a new issue