Loading cmds/statsd/src/atoms.proto +12 −0 Original line number Diff line number Diff line Loading @@ -95,6 +95,7 @@ message Atom { AppStartMemoryStateCaptured app_start_memory_state_captured = 55; ShutdownSequenceReported shutdown_sequence_reported = 56; BootSequenceReported boot_sequence_reported = 57; DaveyOccurred davey_occurred = 58; // TODO: Reorder the numbering so that the most frequent occur events occur in the first 15. } Loading Loading @@ -722,6 +723,17 @@ message BootSequenceReported { optional int64 time_since_last_boot = 6; } /** * Logs the duration of a davey (jank of >=700ms) when it occurs * * Logged from: * frameworks/base/libs/hwui/JankTracker.cpp */ message DaveyOccurred { // Amount of time it took to render the frame. Should be >=700ms. optional int64 jank_duration_ms = 1; } /** * Logs phone signal strength changes. * Loading cmds/statsd/src/metrics/MetricsManager.cpp +16 −7 Original line number Diff line number Diff line Loading @@ -189,13 +189,7 @@ void MetricsManager::onLogEvent(const LogEvent& event) { return; } if (event.GetTagId() != android::util::APP_HOOK) { std::lock_guard<std::mutex> lock(mAllowedLogSourcesMutex); if (mAllowedLogSources.find(event.GetUid()) == mAllowedLogSources.end()) { VLOG("log source %d not on the whitelist", event.GetUid()); return; } } else { // Check that app hook fields are valid. if (event.GetTagId() == android::util::APP_HOOK) { // Check that app hook fields are valid. // TODO: Find a way to make these checks easier to maintain if the app hooks get changed. // Label is 2nd from last field and must be from [0, 15]. Loading @@ -211,6 +205,21 @@ void MetricsManager::onLogEvent(const LogEvent& event) { VLOG("App hook does not have valid state %ld", apphookState); return; } } else if (event.GetTagId() == android::util::DAVEY_OCCURRED) { // Daveys can be logged from any app since they are logged in libs/hwui/JankTracker.cpp. // Check that the davey duration is reasonable. Max length check is for privacy. status_t err = NO_ERROR; long duration = event.GetLong(event.size(), &err); if (err != NO_ERROR || duration > 100000) { VLOG("Davey duration is unreasonably long: %ld", duration); return; } } else { std::lock_guard<std::mutex> lock(mAllowedLogSourcesMutex); if (mAllowedLogSources.find(event.GetUid()) == mAllowedLogSources.end()) { VLOG("log source %d not on the whitelist", event.GetUid()); return; } } int tagId = event.GetTagId(); Loading libs/hwui/Android.bp +14 −3 Original line number Diff line number Diff line Loading @@ -134,6 +134,8 @@ cc_defaults { name: "libhwui_defaults", defaults: ["hwui_defaults"], shared_libs: ["libstatslog"], whole_static_libs: ["libskia"], srcs: [ Loading Loading @@ -318,7 +320,10 @@ cc_test { "libgmock", "libhwui_static_debug", ], shared_libs: ["libmemunreachable"], shared_libs: [ "libmemunreachable", "libstatslog", ], cflags: [ "-include debug/wrap_gles.h", "-DHWUI_NULL_GPU", Loading Loading @@ -383,7 +388,10 @@ cc_benchmark { // set to libhwui_static_debug to skip actual GL commands whole_static_libs: ["libhwui"], shared_libs: ["libmemunreachable"], shared_libs: [ "libmemunreachable", "libstatslog", ], srcs: [ "tests/macrobench/TestSceneRunner.cpp", Loading @@ -405,7 +413,10 @@ cc_benchmark { ], whole_static_libs: ["libhwui_static_debug"], shared_libs: ["libmemunreachable"], shared_libs: [ "libmemunreachable", "libstatslog", ], srcs: [ "tests/microbench/main.cpp", Loading libs/hwui/JankTracker.cpp +2 −0 Original line number Diff line number Diff line Loading @@ -18,6 +18,7 @@ #include <errno.h> #include <inttypes.h> #include <statslog.h> #include <sys/mman.h> #include <algorithm> Loading Loading @@ -164,6 +165,7 @@ void JankTracker::finishFrame(const FrameInfo& frame) { ALOGI("%s", ss.str().c_str()); // Just so we have something that counts up, the value is largely irrelevant ATRACE_INT(ss.str().c_str(), ++sDaveyCount); android::util::stats_write(android::util::DAVEY_OCCURRED, ns2ms(totalDuration)); } } Loading Loading
cmds/statsd/src/atoms.proto +12 −0 Original line number Diff line number Diff line Loading @@ -95,6 +95,7 @@ message Atom { AppStartMemoryStateCaptured app_start_memory_state_captured = 55; ShutdownSequenceReported shutdown_sequence_reported = 56; BootSequenceReported boot_sequence_reported = 57; DaveyOccurred davey_occurred = 58; // TODO: Reorder the numbering so that the most frequent occur events occur in the first 15. } Loading Loading @@ -722,6 +723,17 @@ message BootSequenceReported { optional int64 time_since_last_boot = 6; } /** * Logs the duration of a davey (jank of >=700ms) when it occurs * * Logged from: * frameworks/base/libs/hwui/JankTracker.cpp */ message DaveyOccurred { // Amount of time it took to render the frame. Should be >=700ms. optional int64 jank_duration_ms = 1; } /** * Logs phone signal strength changes. * Loading
cmds/statsd/src/metrics/MetricsManager.cpp +16 −7 Original line number Diff line number Diff line Loading @@ -189,13 +189,7 @@ void MetricsManager::onLogEvent(const LogEvent& event) { return; } if (event.GetTagId() != android::util::APP_HOOK) { std::lock_guard<std::mutex> lock(mAllowedLogSourcesMutex); if (mAllowedLogSources.find(event.GetUid()) == mAllowedLogSources.end()) { VLOG("log source %d not on the whitelist", event.GetUid()); return; } } else { // Check that app hook fields are valid. if (event.GetTagId() == android::util::APP_HOOK) { // Check that app hook fields are valid. // TODO: Find a way to make these checks easier to maintain if the app hooks get changed. // Label is 2nd from last field and must be from [0, 15]. Loading @@ -211,6 +205,21 @@ void MetricsManager::onLogEvent(const LogEvent& event) { VLOG("App hook does not have valid state %ld", apphookState); return; } } else if (event.GetTagId() == android::util::DAVEY_OCCURRED) { // Daveys can be logged from any app since they are logged in libs/hwui/JankTracker.cpp. // Check that the davey duration is reasonable. Max length check is for privacy. status_t err = NO_ERROR; long duration = event.GetLong(event.size(), &err); if (err != NO_ERROR || duration > 100000) { VLOG("Davey duration is unreasonably long: %ld", duration); return; } } else { std::lock_guard<std::mutex> lock(mAllowedLogSourcesMutex); if (mAllowedLogSources.find(event.GetUid()) == mAllowedLogSources.end()) { VLOG("log source %d not on the whitelist", event.GetUid()); return; } } int tagId = event.GetTagId(); Loading
libs/hwui/Android.bp +14 −3 Original line number Diff line number Diff line Loading @@ -134,6 +134,8 @@ cc_defaults { name: "libhwui_defaults", defaults: ["hwui_defaults"], shared_libs: ["libstatslog"], whole_static_libs: ["libskia"], srcs: [ Loading Loading @@ -318,7 +320,10 @@ cc_test { "libgmock", "libhwui_static_debug", ], shared_libs: ["libmemunreachable"], shared_libs: [ "libmemunreachable", "libstatslog", ], cflags: [ "-include debug/wrap_gles.h", "-DHWUI_NULL_GPU", Loading Loading @@ -383,7 +388,10 @@ cc_benchmark { // set to libhwui_static_debug to skip actual GL commands whole_static_libs: ["libhwui"], shared_libs: ["libmemunreachable"], shared_libs: [ "libmemunreachable", "libstatslog", ], srcs: [ "tests/macrobench/TestSceneRunner.cpp", Loading @@ -405,7 +413,10 @@ cc_benchmark { ], whole_static_libs: ["libhwui_static_debug"], shared_libs: ["libmemunreachable"], shared_libs: [ "libmemunreachable", "libstatslog", ], srcs: [ "tests/microbench/main.cpp", Loading
libs/hwui/JankTracker.cpp +2 −0 Original line number Diff line number Diff line Loading @@ -18,6 +18,7 @@ #include <errno.h> #include <inttypes.h> #include <statslog.h> #include <sys/mman.h> #include <algorithm> Loading Loading @@ -164,6 +165,7 @@ void JankTracker::finishFrame(const FrameInfo& frame) { ALOGI("%s", ss.str().c_str()); // Just so we have something that counts up, the value is largely irrelevant ATRACE_INT(ss.str().c_str(), ++sDaveyCount); android::util::stats_write(android::util::DAVEY_OCCURRED, ns2ms(totalDuration)); } } Loading