summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlex Ray2012-11-14 19:28:10 -0600
committerAlex Ray2013-07-30 15:57:00 -0500
commit5b2d36e38adcc09e72f81b06c324bf3c5c92e043 (patch)
tree89f26acfc996e606dad232917f2f2e304e4dbabe /libs/utils/Trace.cpp
parent5ca402a4e2537fa694de120264c5a5e2a4e777bf (diff)
downloadplatform-system-core-5b2d36e38adcc09e72f81b06c324bf3c5c92e043.tar.gz
platform-system-core-5b2d36e38adcc09e72f81b06c324bf3c5c92e043.tar.xz
platform-system-core-5b2d36e38adcc09e72f81b06c324bf3c5c92e043.zip
utils: Use cutils tracing functionality.
Tracing functionality has moved to cutils. Change-Id: Ie78ccc1d59dd5178f5058fbc3858a37f9adce552
Diffstat (limited to 'libs/utils/Trace.cpp')
-rw-r--r--libs/utils/Trace.cpp50
1 files changed, 5 insertions, 45 deletions
diff --git a/libs/utils/Trace.cpp b/libs/utils/Trace.cpp
index f5aaea322..d4f02187f 100644
--- a/libs/utils/Trace.cpp
+++ b/libs/utils/Trace.cpp
@@ -14,52 +14,12 @@
14 * limitations under the License. 14 * limitations under the License.
15 */ 15 */
16 16
17#define LOG_TAG "Trace"
18
19#include <cutils/properties.h>
20#include <utils/Log.h>
21#include <utils/Trace.h>
22#include <utils/misc.h> 17#include <utils/misc.h>
18#include <utils/Trace.h>
23 19
24namespace android { 20static void traceInit() __attribute__((constructor));
25
26volatile int32_t Tracer::sIsReady = 0;
27int Tracer::sTraceFD = -1;
28uint64_t Tracer::sEnabledTags = ATRACE_TAG_NOT_READY;
29Mutex Tracer::sMutex;
30
31void Tracer::changeCallback() {
32 Mutex::Autolock lock(sMutex);
33 if (sIsReady && sTraceFD >= 0) {
34 loadSystemProperty();
35 }
36}
37
38void Tracer::init() {
39 Mutex::Autolock lock(sMutex);
40
41 if (!sIsReady) {
42 add_sysprop_change_callback(changeCallback, 0);
43
44 const char* const traceFileName =
45 "/sys/kernel/debug/tracing/trace_marker";
46 sTraceFD = open(traceFileName, O_WRONLY);
47 if (sTraceFD == -1) {
48 ALOGE("error opening trace file: %s (%d)", strerror(errno), errno);
49 sEnabledTags = 0; // no tracing can occur
50 } else {
51 loadSystemProperty();
52 }
53
54 android_atomic_release_store(1, &sIsReady);
55 }
56}
57 21
58void Tracer::loadSystemProperty() { 22static void traceInit()
59 char value[PROPERTY_VALUE_MAX]; 23{
60 property_get("debug.atrace.tags.enableflags", value, "0"); 24 android::add_sysprop_change_callback(atrace_update_tags, 0);
61 sEnabledTags = (strtoll(value, NULL, 0) & ATRACE_TAG_VALID_MASK)
62 | ATRACE_TAG_ALWAYS;
63} 25}
64
65} // namespace andoid