From 738adf7b466dd960eefa50f6bd969c87e4f89520 Mon Sep 17 00:00:00 2001 From: Paul Crowley Date: Thu, 8 Feb 2018 00:49:37 +0000 Subject: [PATCH] Revert "Don't initialize atrace if it's already disabled." This reverts commit e184423526888dade9c672ea2584127ae1d9d949. Reason for revert: b/73081734 Bug: 73081734 Change-Id: I8ae835f5575292ebd3c4457ef26c2e8f98cfa11e --- libcutils/trace-dev.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/libcutils/trace-dev.cpp b/libcutils/trace-dev.cpp index 27255c2a2..4da821555 100644 --- a/libcutils/trace-dev.cpp +++ b/libcutils/trace-dev.cpp @@ -25,7 +25,6 @@ static pthread_once_t atrace_once_control = PTHREAD_ONCE_INIT; void atrace_set_tracing_enabled(bool enabled) { atomic_store_explicit(&atrace_is_enabled, enabled, memory_order_release); - atomic_store_explicit(&atrace_is_ready, false, memory_order_release); atrace_update_tags(); } @@ -35,17 +34,18 @@ static void atrace_init_once() if (atrace_marker_fd == -1) { ALOGE("Error opening trace file: %s (%d)", strerror(errno), errno); atrace_enabled_tags = 0; - return; + goto done; } + atrace_enabled_tags = atrace_get_property(); + +done: + atomic_store_explicit(&atrace_is_ready, true, memory_order_release); } void atrace_setup() { - if (atomic_load_explicit(&atrace_is_enabled, memory_order_acquire)) { - pthread_once(&atrace_once_control, atrace_init_once); - } - atomic_store_explicit(&atrace_is_ready, true, memory_order_release); + pthread_once(&atrace_once_control, atrace_init_once); } void atrace_begin_body(const char* name)