15 #ifndef FPLBASE_SYSTRACE_H
16 #define FPLBASE_SYSTRACE_H
25 #if FPLBASE_ENABLE_SYSTRACE
27 #error Systrace is only suppported for Android Builds
30 #include <sys/types.h>
33 #endif // FPLBASE_ENABLE_SYSTRACE
35 #define MAX_SYSTRACE_LEN 256
36 int trace_marker = -1;
42 #if FPLBASE_ENABLE_SYSTRACE
43 trace_marker = open(
"/sys/kernel/debug/tracing/trace_marker", O_WRONLY);
45 assert(trace_marker == -1);
56 #if FPLBASE_ENABLE_SYSTRACE
57 char buf[MAX_SYSTRACE_LEN];
58 int len = snprintf(buf, MAX_SYSTRACE_LEN,
"B|%d|%s", getpid(), name);
59 write(trace_marker, buf, len);
65 #if FPLBASE_ENABLE_SYSTRACE
67 write(trace_marker, &c, 1);
80 #if FPLBASE_ENABLE_SYSTRACE
81 char buf[MAX_SYSTRACE_LEN];
83 snprintf(buf, MAX_SYSTRACE_LEN,
"C|%d|%s|%i", getpid(), name, value);
84 write(trace_marker, buf, len);
97 #if FPLBASE_ENABLE_SYSTRACE
98 char buf[MAX_SYSTRACE_LEN];
100 snprintf(buf, MAX_SYSTRACE_LEN,
"S|%d|%s|%i", getpid(), name, cookie);
101 write(trace_marker, buf, len);
114 #if FPLBASE_ENABLE_SYSTRACE
115 char buf[MAX_SYSTRACE_LEN];
117 snprintf(buf, MAX_SYSTRACE_LEN,
"F|%d|%s|%i", getpid(), name, cookie);
118 write(trace_marker, buf, len);
123 #endif // FPLBASE_SYSTRACE_H
void SystraceEnd()
Ends the most recently begun block.
Definition: systrace.h:64
void SystraceAsyncEnd(const char *name, const int32_t cookie)
Ends an asynchronous block.
Definition: systrace.h:111
void SystraceBegin(const char *name)
Start a block, with the supplied name.
Definition: systrace.h:54
void SystraceInit()
Initializes the settings for systrace.
Definition: systrace.h:41
void SystraceAsyncBegin(const char *name, const int32_t cookie)
Begins an asynchronous block.
Definition: systrace.h:94
void SystraceCounter(const char *name, const int value)
Logs a value.
Definition: systrace.h:77