summaryrefslogtreecommitdiffstats
path: root/include/cutils
diff options
context:
space:
mode:
authorChih-Hung Hsieh <chh@google.com>2014-10-15 17:57:07 +0000
committerAndroid Git Automerger <android-git-automerger@android.com>2014-10-15 17:57:07 +0000
commitc37387a4cdc486f3275a64bca235971227eeeffa (patch)
tree97b69cceff761ca7a68d12cf9e0a5ea0617f1225 /include/cutils
parent40d5a79f9882c4c5351f41e57ae574a5ae4d1c1f (diff)
parent07f1300c4c4f7d3c0df540bf8df3443c3f4539cd (diff)
downloadsystem_core-c37387a4cdc486f3275a64bca235971227eeeffa.zip
system_core-c37387a4cdc486f3275a64bca235971227eeeffa.tar.gz
system_core-c37387a4cdc486f3275a64bca235971227eeeffa.tar.bz2
am 07f1300c: am 7979f1ce: Merge "Do not inline rarely used trace function bodies."
* commit '07f1300c4c4f7d3c0df540bf8df3443c3f4539cd': Do not inline rarely used trace function bodies.
Diffstat (limited to 'include/cutils')
-rw-r--r--include/cutils/trace.h50
1 files changed, 11 insertions, 39 deletions
diff --git a/include/cutils/trace.h b/include/cutils/trace.h
index fd24561..c863afd 100644
--- a/include/cutils/trace.h
+++ b/include/cutils/trace.h
@@ -86,13 +86,6 @@ __BEGIN_DECLS
#ifdef HAVE_ANDROID_OS
/**
- * Maximum size of a message that can be logged to the trace buffer.
- * Note this message includes a tag, the pid, and the string given as the name.
- * Names should be kept short to get the most use of the trace buffer.
- */
-#define ATRACE_MESSAGE_LENGTH 1024
-
-/**
* Opens the trace file for writing and reads the property for initial tags.
* The atrace.tags.enableflags property sets the tags to trace.
* This function should not be explicitly called, the first call to any normal
@@ -184,11 +177,8 @@ static inline uint64_t atrace_is_tag_enabled(uint64_t tag)
static inline void atrace_begin(uint64_t tag, const char* name)
{
if (CC_UNLIKELY(atrace_is_tag_enabled(tag))) {
- char buf[ATRACE_MESSAGE_LENGTH];
- size_t len;
-
- len = snprintf(buf, ATRACE_MESSAGE_LENGTH, "B|%d|%s", getpid(), name);
- write(atrace_marker_fd, buf, len);
+ void atrace_begin_body(const char*);
+ atrace_begin_body(name);
}
}
@@ -218,12 +208,8 @@ static inline void atrace_async_begin(uint64_t tag, const char* name,
int32_t cookie)
{
if (CC_UNLIKELY(atrace_is_tag_enabled(tag))) {
- char buf[ATRACE_MESSAGE_LENGTH];
- size_t len;
-
- len = snprintf(buf, ATRACE_MESSAGE_LENGTH, "S|%d|%s|%" PRId32,
- getpid(), name, cookie);
- write(atrace_marker_fd, buf, len);
+ void atrace_async_begin_body(const char*, int32_t);
+ atrace_async_begin_body(name, cookie);
}
}
@@ -232,20 +218,14 @@ static inline void atrace_async_begin(uint64_t tag, const char* name,
* This should have a corresponding ATRACE_ASYNC_BEGIN.
*/
#define ATRACE_ASYNC_END(name, cookie) atrace_async_end(ATRACE_TAG, name, cookie)
-static inline void atrace_async_end(uint64_t tag, const char* name,
- int32_t cookie)
+static inline void atrace_async_end(uint64_t tag, const char* name, int32_t cookie)
{
if (CC_UNLIKELY(atrace_is_tag_enabled(tag))) {
- char buf[ATRACE_MESSAGE_LENGTH];
- size_t len;
-
- len = snprintf(buf, ATRACE_MESSAGE_LENGTH, "F|%d|%s|%" PRId32,
- getpid(), name, cookie);
- write(atrace_marker_fd, buf, len);
+ void atrace_async_end_body(const char*, int32_t);
+ atrace_async_end_body(name, cookie);
}
}
-
/**
* Traces an integer counter value. name is used to identify the counter.
* This can be used to track how a value changes over time.
@@ -254,12 +234,8 @@ static inline void atrace_async_end(uint64_t tag, const char* name,
static inline void atrace_int(uint64_t tag, const char* name, int32_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|%" PRId32,
- getpid(), name, value);
- write(atrace_marker_fd, buf, len);
+ void atrace_int_body(const char*, int32_t);
+ atrace_int_body(name, value);
}
}
@@ -271,12 +247,8 @@ static inline void atrace_int(uint64_t tag, const char* name, int32_t 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|%" PRId64,
- getpid(), name, value);
- write(atrace_marker_fd, buf, len);
+ void atrace_int64_body(const char*, int64_t);
+ atrace_int64_body(name, value);
}
}