diff options
author | Alex Ray | 2012-11-14 19:28:10 -0600 |
---|---|---|
committer | Alex Ray | 2013-07-30 15:57:00 -0500 |
commit | 5b2d36e38adcc09e72f81b06c324bf3c5c92e043 (patch) | |
tree | 89f26acfc996e606dad232917f2f2e304e4dbabe /libs | |
parent | 5ca402a4e2537fa694de120264c5a5e2a4e777bf (diff) | |
download | platform-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')
-rw-r--r-- | libs/utils/Trace.cpp | 50 |
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 | ||
24 | namespace android { | 20 | static void traceInit() __attribute__((constructor)); |
25 | |||
26 | volatile int32_t Tracer::sIsReady = 0; | ||
27 | int Tracer::sTraceFD = -1; | ||
28 | uint64_t Tracer::sEnabledTags = ATRACE_TAG_NOT_READY; | ||
29 | Mutex Tracer::sMutex; | ||
30 | |||
31 | void Tracer::changeCallback() { | ||
32 | Mutex::Autolock lock(sMutex); | ||
33 | if (sIsReady && sTraceFD >= 0) { | ||
34 | loadSystemProperty(); | ||
35 | } | ||
36 | } | ||
37 | |||
38 | void 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 | ||
58 | void Tracer::loadSystemProperty() { | 22 | static 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 | ||