summaryrefslogtreecommitdiffstats
path: root/include/cutils/trace.h
diff options
context:
space:
mode:
authorThe Android Open Source Project <initial-contribution@android.com>2013-11-22 11:28:10 -0800
committerConley Owens <cco3@android.com>2013-11-22 13:44:43 -0800
commit66ed50af6870210ce013a5588a688434a5d48ee9 (patch)
treea879f3ea31083496d0efe491bc187b6e0ebada39 /include/cutils/trace.h
parentdd2ac3de625e6c0328a0f70530d8ade0d2151bfc (diff)
parent536dea9d61a032e64bbe584a97463c6638ead009 (diff)
downloadsystem_core-66ed50af6870210ce013a5588a688434a5d48ee9.zip
system_core-66ed50af6870210ce013a5588a688434a5d48ee9.tar.gz
system_core-66ed50af6870210ce013a5588a688434a5d48ee9.tar.bz2
Merge commit '536dea9d61a032e64bbe584a97463c6638ead009' into HEAD
Change-Id: I5c469a4b738629d99d721cad7ded02d6c35f56d5
Diffstat (limited to 'include/cutils/trace.h')
-rw-r--r--include/cutils/trace.h22
1 files changed, 20 insertions, 2 deletions
diff --git a/include/cutils/trace.h b/include/cutils/trace.h
index 29034ca..1c8f107 100644
--- a/include/cutils/trace.h
+++ b/include/cutils/trace.h
@@ -66,7 +66,8 @@ __BEGIN_DECLS
#define ATRACE_TAG_APP (1<<12)
#define ATRACE_TAG_RESOURCES (1<<13)
#define ATRACE_TAG_DALVIK (1<<14)
-#define ATRACE_TAG_LAST ATRACE_TAG_DALVIK
+#define ATRACE_TAG_RS (1<<15)
+#define ATRACE_TAG_LAST ATRACE_TAG_RS
// Reserved for initialization.
#define ATRACE_TAG_NOT_READY (1LL<<63)
@@ -258,11 +259,28 @@ static inline void atrace_int(uint64_t tag, const char* name, int32_t value)
}
}
+/**
+ * Traces a 64-bit integer counter value. name is used to identify the
+ * counter. This can be used to track how a value changes over time.
+ */
+#define ATRACE_INT64(name, value) atrace_int64(ATRACE_TAG, name, value)
+static inline void atrace_int64(uint64_t tag, const char* name, int64_t value)
+{
+ if (CC_UNLIKELY(atrace_is_tag_enabled(tag))) {
+ char buf[ATRACE_MESSAGE_LENGTH];
+ size_t len;
+
+ len = snprintf(buf, ATRACE_MESSAGE_LENGTH, "C|%d|%s|%lld",
+ getpid(), name, value);
+ write(atrace_marker_fd, buf, len);
+ }
+}
+
#else // not HAVE_ANDROID_OS
#define ATRACE_INIT()
#define ATRACE_GET_ENABLED_TAGS()
-#define ATRACE_ENABLED()
+#define ATRACE_ENABLED() 0
#define ATRACE_BEGIN(name)
#define ATRACE_END()
#define ATRACE_ASYNC_BEGIN(name, cookie)