summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlex Ray <aray@google.com>2012-11-30 19:32:12 -0800
committerAlex Ray <aray@google.com>2013-07-30 13:57:00 -0700
commitfcb349ff75272c802519a20abc0e083c35bbe8cf (patch)
treea5caac51b5c91abe93bf4dc351e227859e43bcd9
parent0a19c906f20fe7ded0c2ab5b1c8cf29137fb0fa9 (diff)
downloadsystem_core-fcb349ff75272c802519a20abc0e083c35bbe8cf.zip
system_core-fcb349ff75272c802519a20abc0e083c35bbe8cf.tar.gz
system_core-fcb349ff75272c802519a20abc0e083c35bbe8cf.tar.bz2
utils: clarify scoped tracing functionality
ScopedTrace objects were being used in place of ATRACE_NAME because of a misunderstanding of it's function. Cleared up documentation for usage. Also explicitly use global namespace for sysprop callback. Change-Id: I7c248b486b614ccdb841659ca0dcfc644fda670a
-rw-r--r--include/utils/Trace.h13
-rw-r--r--libs/utils/Trace.cpp2
2 files changed, 6 insertions, 9 deletions
diff --git a/include/utils/Trace.h b/include/utils/Trace.h
index 940aec1..49578c4 100644
--- a/include/utils/Trace.h
+++ b/include/utils/Trace.h
@@ -31,15 +31,12 @@
// See <cutils/trace.h> for more ATRACE_* macros.
-// ATRACE_CALL traces the beginning and end of the current function. To trace
-// the correct start and end times this macro should be the first line of the
-// function body.
-#define ATRACE_CALL() android::ScopedTrace ___tracer(ATRACE_TAG, __FUNCTION__)
-
-// ATRACE_NAME traces the beginning and end of the current function. To trace
-// the correct start and end times this macro should be the first line of the
-// function body.
+// ATRACE_NAME traces the beginning and end of the current scope. To trace
+// the correct start and end times this macro should be declared first in the
+// scope body.
#define ATRACE_NAME(name) android::ScopedTrace ___tracer(ATRACE_TAG, name)
+// ATRACE_CALL is an ATRACE_NAME that uses the current function name.
+#define ATRACE_CALL() ATRACE_NAME(__FUNCTION__)
namespace android {
diff --git a/libs/utils/Trace.cpp b/libs/utils/Trace.cpp
index d4f0218..36fd802 100644
--- a/libs/utils/Trace.cpp
+++ b/libs/utils/Trace.cpp
@@ -21,5 +21,5 @@ static void traceInit() __attribute__((constructor));
static void traceInit()
{
- android::add_sysprop_change_callback(atrace_update_tags, 0);
+ ::android::add_sysprop_change_callback(atrace_update_tags, 0);
}