Revert "Don't initialize atrace if it's already disabled."
This reverts commit e184423526888dade9c672ea2584127ae1d9d949.
Reason for revert: b/73081734
Bug: 73081734
Change-Id: I8ae835f5575292ebd3c4457ef26c2e8f98cfa11e
diff --git a/libcutils/trace-dev.cpp b/libcutils/trace-dev.cpp
index 27255c2..4da8215 100644
--- a/libcutils/trace-dev.cpp
+++ b/libcutils/trace-dev.cpp
@@ -25,7 +25,6 @@
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 @@
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)