Loading include/cutils/trace.h +6 −0 Original line number Diff line number Diff line Loading @@ -85,6 +85,12 @@ __BEGIN_DECLS */ void atrace_setup(); /** * If tracing is ready, set atrace_enabled_tags to the system property * debug.atrace.tags.enableflags. Can be used as a sysprop change callback. */ void atrace_update_tags(); /** * Flag indicating whether setup has been completed, initialized to 0. * Nonzero indicates setup has completed. Loading libcutils/trace.c +13 −0 Original line number Diff line number Diff line Loading @@ -33,6 +33,7 @@ int32_t atrace_is_ready = 0; int atrace_marker_fd = -1; uint64_t atrace_enabled_tags = ATRACE_TAG_NOT_READY; static pthread_once_t atrace_once_control = PTHREAD_ONCE_INIT; static pthread_mutex_t atrace_tags_mutex = PTHREAD_MUTEX_INITIALIZER; // Read the sysprop and return the value tags should be set to static uint64_t atrace_get_property() Loading @@ -54,6 +55,18 @@ static uint64_t atrace_get_property() return (tags | ATRACE_TAG_ALWAYS) & ATRACE_TAG_VALID_MASK; } // Update tags if tracing is ready. Useful as a sysprop change callback. void atrace_update_tags() { uint64_t tags; if (CC_UNLIKELY(android_atomic_acquire_load(&atrace_is_ready))) { tags = atrace_get_property(); pthread_mutex_lock(&atrace_tags_mutex); atrace_enabled_tags = tags; pthread_mutex_unlock(&atrace_tags_mutex); } } static void atrace_init_once() { atrace_marker_fd = open("/sys/kernel/debug/tracing/trace_marker", O_WRONLY); Loading Loading
include/cutils/trace.h +6 −0 Original line number Diff line number Diff line Loading @@ -85,6 +85,12 @@ __BEGIN_DECLS */ void atrace_setup(); /** * If tracing is ready, set atrace_enabled_tags to the system property * debug.atrace.tags.enableflags. Can be used as a sysprop change callback. */ void atrace_update_tags(); /** * Flag indicating whether setup has been completed, initialized to 0. * Nonzero indicates setup has completed. Loading
libcutils/trace.c +13 −0 Original line number Diff line number Diff line Loading @@ -33,6 +33,7 @@ int32_t atrace_is_ready = 0; int atrace_marker_fd = -1; uint64_t atrace_enabled_tags = ATRACE_TAG_NOT_READY; static pthread_once_t atrace_once_control = PTHREAD_ONCE_INIT; static pthread_mutex_t atrace_tags_mutex = PTHREAD_MUTEX_INITIALIZER; // Read the sysprop and return the value tags should be set to static uint64_t atrace_get_property() Loading @@ -54,6 +55,18 @@ static uint64_t atrace_get_property() return (tags | ATRACE_TAG_ALWAYS) & ATRACE_TAG_VALID_MASK; } // Update tags if tracing is ready. Useful as a sysprop change callback. void atrace_update_tags() { uint64_t tags; if (CC_UNLIKELY(android_atomic_acquire_load(&atrace_is_ready))) { tags = atrace_get_property(); pthread_mutex_lock(&atrace_tags_mutex); atrace_enabled_tags = tags; pthread_mutex_unlock(&atrace_tags_mutex); } } static void atrace_init_once() { atrace_marker_fd = open("/sys/kernel/debug/tracing/trace_marker", O_WRONLY); Loading