INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/include)
ADD_DEFINITIONS("-DPREFIX=\"${PREFIX}\"")
-
# compiler flags
SET(EXTRA_CFLAGS "${EXTRA_CFLAGS}")
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${EXTRA_CFLAGS}")
/* Define TTRACE_TAG */
#define TTRACE_TAG_NEVER 0 // This tag is never enabled.
#define TTRACE_TAG_ALWAYS (1<<0) // This tag is always enabled.
-#define TTRACE_TAG_APP TTRACE_TAG_ALWAYS
#define TTRACE_TAG_GRAPHICS (1<<1)
#define TTRACE_TAG_INPUT (1<<2)
#define TTRACE_TAG_VIEW (1<<3)
#define TTRACE_TAG_MEDIA_CONTENT (1<<12)
#define TTRACE_TAG_MEDIA_DB (1<<13)
#define TTRACE_TAG_SCREEN_MIRRORING (1<<14)
-#define TTRACE_TAG_LAST TTRACE_TAG_SCREEN_MIRRORING
+#define TTRACE_TAG_APP (1<<15)
+#define TTRACE_TAG_LAST TTRACE_TAG_APP
+#define ENABLED_TAG_FILE "/etc/ttrace/ttrace_tag"
void traceBegin(int tag, const char *name, ...);
void traceEnd(int tag);
void traceAsyncBegin(int tag, int cookie, const char *name, ...);
#!/bin/bash
-conf="/etc/ttrace.conf"
+conf="/etc/ttrace/ttrace.conf"
change_permission="--update"
chmod 0222 /sys/kernel/debug/tracing/trace_marker
#attr -S -s SMACK64 -V '*' /sys/kernel/debug/tracing/events/cpufreq_interactive/enable
attr -S -s SMACK64 -V '*' /sys/kernel/debug/tracing/tracing_on
attr -S -s SMACK64 -V '*' /sys/kernel/debug/tracing/trace
-attr -S -s SMACK64 -V '*' /usr/bin/atrace
if [ -e "$conf" ]
then
rm "$conf"
else
echo "$conf was NOT found!!!"
- atrace
+ atrace --init_exec
echo 0 > "/sys/kernel/debug/tracing/trace"
echo 0 > "/sys/kernel/debug/tracing/tracing_on"
fi
[Service]
Type=simple
ExecStart=/usr/bin/exec-ttrace-marker
+SmackProcessLabel=ttrace
[Install]
WantedBy=sys-kernel-debug.mount
Source0: %{name}-%{version}.tar.gz
SOURCE101: packaging/exec-ttrace-marker
SOURCE102: packaging/ttrace-marker.service
+SOURCE103: packaging/ttrace_tag
+
BuildRequires: pkgconfig(dlog)
BuildRequires: pkgconfig(zlib)
BuildRequires: pkgconfig(capi-base-common)
cp LICENSE %{buildroot}/usr/share/license/%{name}
mkdir -p %{buildroot}/etc/systemd/system/sys-kernel-debug.mount.wants/
ln -s %{_libdir}/systemd/system/ttrace-marker.service %{buildroot}/etc/systemd/system/sys-kernel-debug.mount.wants/ttrace-marker.service
+mkdir -p %{buildroot}/etc/ttrace
+cp %{SOURCE103} %{buildroot}/etc/ttrace
%post -p /sbin/ldconfig
%attr(755,root,root) %{_bindir}/atrace
%attr(755,root,root) %{_bindir}/atrace-1.1
%attr(755,root,root) %{_bindir}/exec-ttrace-marker
+%attr(664,root,root) /etc/ttrace/ttrace_tag
/etc/systemd/system/sys-kernel-debug.mount.wants/ttrace-marker.service
/usr/share/license/%{name}
--- /dev/null
+0
\ No newline at end of file
#include <stdint.h>
#include <strings.h>
#include <string.h>
-#include <sys/ipc.h>
-#include <sys/shm.h>
+#include <sys/mman.h>
#include "ttrace.h"
#define TTRACE_TAG_NONE 9999
#define TAG_NONE_IDX 0
+
#else
#include <binder/IBinder.h>
#include <binder/IServiceManager.h>
enum { MAX_SYS_FILES = 8 };
-#ifdef DEVICE_TYPE_TIZEN
-static uint32_t *sm_for_enabled_tag = NULL;
-#else
const char* k_traceTagsProperty = "debug.atrace.tags.enableflags";
const char* k_traceAppCmdlineProperty = "debug.atrace.app_cmdlines";
-#endif
typedef enum { OPT, REQ } requiredness ;
+char str_error[256] = "";
+
struct TracingCategory {
// The name identifying the category.
const char* name;
/* Tracing categories */
static const TracingCategory k_categories[] = {
#ifdef DEVICE_TYPE_TIZEN
- { "none", "None", TTRACE_TAG_NONE, { } }, //do not change "none" option's index
- { "gfx", "Graphics", TTRACE_TAG_GRAPHICS, { } },
- { "input", "Input", TTRACE_TAG_INPUT, { } },
- { "view", "View System", TTRACE_TAG_VIEW, { } },
- { "web", "Web", TTRACE_TAG_WEB, { } },
- { "wm", "Window Manager", TTRACE_TAG_WINDOW_MANAGER, { } },
- { "am", "Application Manager", TTRACE_TAG_APPLICATION_MANAGER, { } },
- { "image", "Image", TTRACE_TAG_IMAGE, { } },
- { "audio", "Audio", TTRACE_TAG_AUDIO, { } },
- { "video", "Video", TTRACE_TAG_VIDEO, { } },
- { "camera", "Camera", TTRACE_TAG_CAMERA, { } },
- { "hal", "Hardware Modules", TTRACE_TAG_HAL, { } },
- { "mc", "Multimedia content", TTRACE_TAG_MEDIA_CONTENT, { } },
- { "mdb", "Multimedia database", TTRACE_TAG_MEDIA_DB, { } },
- { "scmirroring","Screen mirroring", TTRACE_TAG_SCREEN_MIRRORING, { } },
+ { "none", "None", TTRACE_TAG_NONE, { } }, //do not change "none" option's index
+ { "gfx", "Graphics", TTRACE_TAG_GRAPHICS, { } },
+ { "input", "Input", TTRACE_TAG_INPUT, { } },
+ { "view", "View System", TTRACE_TAG_VIEW, { } },
+ { "web", "Web", TTRACE_TAG_WEB, { } },
+ { "wm", "Window Manager", TTRACE_TAG_WINDOW_MANAGER, { } },
+ { "am", "Application Manager", TTRACE_TAG_APPLICATION_MANAGER, { } },
+ { "image", "Image", TTRACE_TAG_IMAGE, { } },
+ { "audio", "Audio", TTRACE_TAG_AUDIO, { } },
+ { "video", "Video", TTRACE_TAG_VIDEO, { } },
+ { "camera", "Camera", TTRACE_TAG_CAMERA, { } },
+ { "hal", "Hardware Modules", TTRACE_TAG_HAL, { } },
+ { "mc", "Multimedia content", TTRACE_TAG_MEDIA_CONTENT, { } },
+ { "mdb", "Multimedia database", TTRACE_TAG_MEDIA_DB, { } },
+ { "scmirroring", "Screen mirroring", TTRACE_TAG_SCREEN_MIRRORING, { } },
+ { "app", "Application", TTRACE_TAG_APP, { } },
#else
{ "gfx", "Graphics", ATRACE_TAG_GRAPHICS, { } },
{ "input", "Input", ATRACE_TAG_INPUT, { } },
int traceFD = creat(path, 0);
if (traceFD == -1) {
fprintf(stderr, "error truncating %s: %s (%d)\n", path,
- strerror(errno), errno);
+ strerror_r(errno, str_error, sizeof(str_error)), errno);
return false;
}
int fd = open(filename, flags);
if (fd == -1) {
fprintf(stderr, "error opening %s: %s (%d)\n", filename,
- strerror(errno), errno);
+ strerror_r(errno, str_error, sizeof(str_error)), errno);
return false;
}
ssize_t len = strlen(str);
if (write(fd, str, len) != len) {
fprintf(stderr, "error writing to %s: %s (%d)\n", filename,
- strerror(errno), errno);
+ strerror_r(errno, str_error, sizeof(str_error)), errno);
ok = false;
}
static bool setTagsProperty(uint64_t tags)
{
#ifdef DEVICE_TYPE_TIZEN
- int shmid;
- int skey = 1106;
- void *shm_val = (void *) 0;
-
- if (sm_for_enabled_tag == NULL) {
- if(-1 == (shmid = shmget((key_t)skey, sizeof(int), 0666|IPC_CREAT)))
- {
- fprintf(stderr, "error: shmget() failed\n");
- return false;
- }
- if((void *)-1 == (shm_val = (void *) shmat(shmid, (void *)0, 0)))
- {
- fprintf(stderr, "error: shmat() failed\n");
- return false;
- }
- sm_for_enabled_tag = (uint32_t *)shm_val;
+ uint64_t *sm_for_enabled_tag = NULL;
+ int fd = -1;
+ fd = open(ENABLED_TAG_FILE, O_RDWR | O_CLOEXEC, 0666);
+
+ if(fd < 0){
+ fprintf(stderr, "Fail to open enabled_tag file: %s(%d)\n", strerror_r(errno, str_error, sizeof(str_error)), errno);
+ return false;
}
-
- if(tags){
- *sm_for_enabled_tag = (uint32_t)tags;
- fprintf(stderr, "Enabled TAGs: %u\n", (uint32_t)*sm_for_enabled_tag); /* just for debugging */
- } else {
- *sm_for_enabled_tag = (uint32_t)0;
+ sm_for_enabled_tag = (uint64_t*)mmap(NULL, sizeof(uint64_t), PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0);
+
+ if(sm_for_enabled_tag == MAP_FAILED) {
+ fprintf(stderr, "error: mmap() failed(%s)\n", strerror_r(errno, str_error, sizeof(str_error)));
+ return false;
}
+ *sm_for_enabled_tag = tags;
+ fprintf(stderr, "Enabled TAGs: %u\n", (uint32_t)*sm_for_enabled_tag);
+
+ munmap(sm_for_enabled_tag, sizeof(uint64_t));
+ close(fd);
#else
char buf[64];
snprintf(buf, 64, "%#llx", tags);
int fd = open(k_ftraceFilterPath, O_RDONLY);
if (fd == -1) {
fprintf(stderr, "error opening %s: %s (%d)\n", k_ftraceFilterPath,
- strerror(errno), errno);
+ strerror_r(errno, str_error, sizeof(str_error)), errno);
return false;
}
close(fd);
if (n == -1) {
fprintf(stderr, "error reading %s: %s (%d)\n", k_ftraceFilterPath,
- strerror(errno), errno);
+ strerror_r(errno, str_error, sizeof(str_error)), errno);
return false;
}
int traceFD = open(k_tracePath, O_RDWR);
if (traceFD == -1) {
fprintf(stderr, "error opening %s: %s (%d)\n", k_tracePath,
- strerror(errno), errno);
+ strerror_r(errno, str_error, sizeof(str_error)), errno);
return;
}
result = read(traceFD, in, bufSize);
if (result < 0) {
fprintf(stderr, "error reading trace: %s (%d)\n",
- strerror(errno), errno);
+ strerror_r(errno, str_error, sizeof(str_error)), errno);
result = Z_STREAM_END;
break;
} else if (result == 0) {
result = write(STDOUT_FILENO, out, bufSize);
if ((size_t)result < bufSize) {
fprintf(stderr, "error writing deflated trace: %s (%d)\n",
- strerror(errno), errno);
+ strerror_r(errno, str_error, sizeof(str_error)), errno);
result = Z_STREAM_END; // skip deflate error message
zs.avail_out = bufSize; // skip the final write
break;
result = write(STDOUT_FILENO, out, bytes);
if ((size_t)result < bytes) {
fprintf(stderr, "error writing deflated trace: %s (%d)\n",
- strerror(errno), errno);
+ strerror_r(errno, str_error, sizeof(str_error)), errno);
}
}
ssize_t sent = 0;
while ((sent = sendfile(STDOUT_FILENO, traceFD, NULL, 64*1024*1024)) > 0);
if (sent == -1) {
- fprintf(stderr, "error dumping trace: %s (%d)\n", strerror(errno),
+ fprintf(stderr, "error dumping trace: %s (%d)\n", strerror_r(errno, str_error, sizeof(str_error)),
errno);
}
}
{"async_stop", no_argument, 0, 0 },
{"async_dump", no_argument, 0, 0 },
{"list_categories", no_argument, 0, 0 },
+#ifdef DEVICE_TYPE_TIZEN
+ {"init_exec", no_argument, 0, 0 },
+#endif
{ 0, 0, 0, 0 }
};
#ifndef DEVICE_TYPE_TIZEN
} else if (!strcmp(long_options[option_index].name, "list_categories")) {
listSupportedCategories();
exit(0);
- }
+ } else if (!strcmp(long_options[option_index].name, "init_exec")) {
+ fprintf(stderr, "init_exec\n");
+ setTagsProperty(0);
+ exit(0);
+ }
#endif
break;
}
bool ok = true;
- ok &= setUpTrace();
+ if (!(async && !g_traceOverwrite))
+ ok &= setUpTrace();
ok &= startTrace();
if (ok && traceStart) {
#include "dlog.h"
#include "ttrace.h"
#include "trace.h"
+#include "stdint.h"
#define ENABLE_TTRACE
#ifdef ENABLE_TTRACE
/* In "TTRACE_DEBUG" mode, dlog will print T-trace debug log */
-//#define TTRACE_DEBUG
-//#undef TTRACE_DEBUG
+#define TTRACE_DEBUG
+#undef TTRACE_DEBUG
#ifdef TTRACE_DEBUG
#define TTRACE_LOG(format, arg...) dlog_print(3, "TTRACE", format, ##arg)
#include <fcntl.h>
#include <unistd.h>
-#include <errno.h>
#include <sys/types.h>
#include <sys/syscall.h>
-#include <sys/ipc.h>
-#include <sys/shm.h>
+#include <sys/mman.h>
#define TRACE_FILE "/sys/kernel/debug/tracing/trace_marker"
+
#define MAX_TRACE_LEN 1024
#define MAX_LEN 512
#define FD_INITIAL_VALUE -1
#define TRACE_FILE_NOT_EXIST -2
int g_trace_handle_fd = FD_INITIAL_VALUE;
-static unsigned int *cur_enabled_tag = NULL;
+int g_enabled_tag_fd = FD_INITIAL_VALUE;
-static unsigned int traceInit() {
- int shmid;
- int skey = 1106;
- int *sm_for_enabled_tag;
+static uint64_t dummy = 0;
+uint64_t *cur_enabled_tag = (void *)&dummy;
- g_trace_handle_fd = open(TRACE_FILE, O_WRONLY);
+static uint64_t traceInit()
+{
+ uint64_t *sm_for_enabled_tag;
- if (g_trace_handle_fd < 0) {
+ g_trace_handle_fd = open(TRACE_FILE, O_WRONLY);
+ if (g_trace_handle_fd < 0) {
TTRACE_LOG("Fail to open trace file: %s(%d)", strerror(errno), errno);
- //in case ftrace debugfs is not mounted, ttrace does not call traceInit() anymore.
- if(errno == ENOENT){
+ /* in case ftrace debugfs is not mounted, ttrace does not call traceInit() anymore. */
+ if (errno == ENOENT)
g_trace_handle_fd = TRACE_FILE_NOT_EXIST;
- }
- set_last_result(TRACE_ERROR_IO_ERROR);
+
+ set_last_result(TRACE_ERROR_IO_ERROR);
return 0;
- }
- if(cur_enabled_tag == NULL) {
- //create shared memory for caching enabled tag
- if(-1 == (shmid = shmget((key_t)skey, sizeof(unsigned int), 0666|IPC_CREAT)))
- {
- TTRACE_LOG("Fail to create new segment!(or Fail to get existing segment identifier), %s(%d)", strerror(errno), errno);
- goto error;
+ }
+ if (cur_enabled_tag == ((void *)&dummy)) {
+ g_enabled_tag_fd = open(ENABLED_TAG_FILE, O_RDONLY | O_CLOEXEC);
+ if (g_enabled_tag_fd < 0) {
+ TTRACE_LOG("Fail to open enabled_tag file: %s(%d)", strerror(errno), errno);
+ if (errno == ENOENT)
+ g_enabled_tag_fd = TRACE_FILE_NOT_EXIST;
+
+ return 0;
}
- if((void *)-1 == (sm_for_enabled_tag = (int *)shmat(shmid, (void *)0, 0)))
- {
- TTRACE_LOG("Fail to attach the shared memory segment to this proc, %s(%d)", strerror(errno), errno);
- goto error;
+ sm_for_enabled_tag = mmap(NULL, sizeof(uint64_t), PROT_READ, MAP_SHARED, g_enabled_tag_fd, 0);
+ if (sm_for_enabled_tag == MAP_FAILED) {
+ TTRACE_LOG("error: mmap() failed(%s)\n", strerror(errno));
+ return 0;
}
- cur_enabled_tag = (unsigned int *)sm_for_enabled_tag;
- TTRACE_LOG("attach success: %u %p", *cur_enabled_tag, cur_enabled_tag);
+ cur_enabled_tag = sm_for_enabled_tag;
+ TTRACE_LOG("cur_enabled_tag: %u %p", *cur_enabled_tag, cur_enabled_tag);
+
return *cur_enabled_tag;
} else {
TTRACE_LOG("traceInit: %u", *cur_enabled_tag);
- return *cur_enabled_tag;
+ return *cur_enabled_tag;
}
-error:
- close(g_trace_handle_fd);
- g_trace_handle_fd = FD_INITIAL_VALUE;
- return 0;
}
-static inline unsigned int isTagEnabled(unsigned int cur_tag) {
- if (g_trace_handle_fd == TRACE_FILE_NOT_EXIST)
+static inline uint64_t isTagEnabled(uint64_t cur_tag)
+{
+ if (g_trace_handle_fd == TRACE_FILE_NOT_EXIST || g_enabled_tag_fd == TRACE_FILE_NOT_EXIST)
return 0;
- //if no tag is enabled, trace all tags.
- if(cur_tag == TTRACE_TAG_APP) cur_enabled_tag = &cur_tag;
- else cur_tag |= TTRACE_TAG_ALWAYS;
+ /* if no tag is enabled, trace all tags. */
+ cur_tag |= TTRACE_TAG_ALWAYS;
- if (g_trace_handle_fd < 0 || cur_enabled_tag == NULL){
+ if (g_trace_handle_fd < 0 || cur_enabled_tag == ((void *)&dummy))
return (cur_tag & traceInit());
- }
+
return (cur_tag & *cur_enabled_tag);
}
-/*
+/*
* Tracing API for synchronous events: traceBegin()/traceEnd()
* - tag: the tracing tag
* - name: the event name
*/
-inline void traceBegin(int tag, const char *name, ...) {
- if(isTagEnabled(tag)) {
+inline void traceBegin(int tag, const char *name, ...)
+{
+ if (isTagEnabled(tag)) {
char buf[MAX_LEN];
int len = 0;
va_list ap;
TTRACE_LOG("traceBegin:: write >> tag: %u tag_bit: %u", tag, *cur_enabled_tag);
va_start(ap, name);
len = snprintf(buf, MAX_LEN, "B|%d|", getpid());
- len += vsnprintf(buf+len, MAX_LEN-len, name, ap);
+ len += vsnprintf(buf + len, MAX_LEN - len, name, ap);
va_end(ap);
write(g_trace_handle_fd, buf, len);
}
#ifdef TTRACE_DEBUG
- else {
- TTRACE_LOG("traceBegin:: disabled tag");
- }
+ else
+ TTRACE_LOG("traceBegin:: disabled tag >> tag: %u tag_bit: %u", tag, *cur_enabled_tag);
+
#endif
}
-inline void traceEnd(int tag) {
- if(isTagEnabled(tag)) {
+
+inline void traceEnd(int tag)
+{
+ if (isTagEnabled(tag)) {
char end = 'E';
TTRACE_LOG("traceEnd:: write>> tag: %u tag_bit: %u", tag, *cur_enabled_tag);
write(g_trace_handle_fd, &end, 1);
}
#ifdef TTRACE_DEBUG
- else {
- TTRACE_LOG("traceEnd:: disabled tag");
- }
+ else
+ TTRACE_LOG("traceEnd:: disabled tag >> tag: %u tag_bit: %u", tag, *cur_enabled_tag);
+
#endif
}
-/*
+
+/*
* Tracing API for asynchronous events: traceAsyncBegin()/traceAsyncEnd()
* - tag: the tracing tag
* - name: the event name
- * - cookie: an unique identifier for distinguishing simultaneous events.
+ * - cookie: an unique identifier for distinguishing simultaneous events.
* The name and cookie used to begin an event must be used to end it.
*/
-inline void traceAsyncBegin(int tag, int cookie, const char *name, ...) {
- if(isTagEnabled(tag)) {
+inline void traceAsyncBegin(int tag, int cookie, const char *name, ...)
+{
+ if (isTagEnabled(tag)) {
char buf[MAX_LEN];
int len = 0;
va_list ap;
TTRACE_LOG("traceAsyncBegin:: write >> tag: %u tag_bit: %u cookie: %d", tag, *cur_enabled_tag, cookie);
va_start(ap, name);
len = snprintf(buf, MAX_LEN, "S|%d|", getpid());
- len += vsnprintf(buf+len, MAX_LEN-len, name, ap);
- len += snprintf(buf+len, MAX_LEN-len, "|%d", cookie);
+ len += vsnprintf(buf + len, MAX_LEN - len, name, ap);
+ len += snprintf(buf + len, MAX_LEN - len, "|%d", cookie);
va_end(ap);
write(g_trace_handle_fd, buf, len);
}
#ifdef TTRACE_DEBUG
- else {
- TTRACE_LOG("traceAsyncBegin:: disabled tag");
- }
+ else
+ TTRACE_LOG("traceAsyncBegin:: disabled tag >> tag: %u tag_bit: %u", tag, *cur_enabled_tag);
+
#endif
}
-inline void traceAsyncEnd(int tag, int cookie, const char *name, ...) {
- if(isTagEnabled(tag)) {
+
+inline void traceAsyncEnd(int tag, int cookie, const char *name, ...)
+{
+ if (isTagEnabled(tag)) {
char buf[MAX_LEN];
- int len = 0;
+ int len = 0;
va_list ap;
TTRACE_LOG("traceAsyncEnd:: write>> tag: %u tag_bit: %u", tag, *cur_enabled_tag);
va_start(ap, name);
len = snprintf(buf, MAX_LEN, "F|%d|", getpid());
- len += vsnprintf(buf+len, MAX_LEN-len, name, ap);
- len += snprintf(buf+len, MAX_LEN-len, "|%d", cookie);
- write(g_trace_handle_fd, buf, len);
+ len += vsnprintf(buf + len, MAX_LEN - len, name, ap);
+ len += snprintf(buf + len, MAX_LEN - len, "|%d", cookie);
+ write(g_trace_handle_fd, buf, len);
}
#ifdef TTRACE_DEBUG
- else {
- TTRACE_LOG("traceAsyncEnd:: disabled tag");
- }
+ else
+ TTRACE_LOG("traceAsyncEnd:: disabled tag >> tag: %u tag_bit: %u", tag, *cur_enabled_tag);
+
#endif
}
-/*
+/*
* Tracing API for marking occurrences of trace event: traceMark
* - tag: the tracing tag
* - name: the event name
*/
-inline void traceMark(int tag, const char *name, ...) {
- if(isTagEnabled(tag)) {
+/* LCOV_EXCL_START */
+inline void traceMark(int tag, const char *name, ...)
+{
+ if (isTagEnabled(tag)) {
char buf[MAX_LEN], end = 'E';
- int len = 0;
- va_list ap;
+ int len = 0;
+ va_list ap;
- TTRACE_LOG("traceMark:: write >> tag: %u tag_bit: %u", tag, *cur_enabled_tag);
+ TTRACE_LOG("traceMark:: write >> tag: %u tag_bit: %u", tag, *cur_enabled_tag);
va_start(ap, name);
- len = snprintf(buf, MAX_LEN, "B|%d|", getpid());
- len +=vsnprintf(buf+len, MAX_LEN-len, name, ap);
- va_end(ap);
- write(g_trace_handle_fd, buf, len);
- write(g_trace_handle_fd, &end, 1);
- }
+ len = snprintf(buf, MAX_LEN, "B|%d|", getpid());
+ len += vsnprintf(buf + len, MAX_LEN - len, name, ap);
+ va_end(ap);
+ write(g_trace_handle_fd, buf, len);
+ write(g_trace_handle_fd, &end, 1);
+ }
#ifdef TTRACE_DEBUG
- else {
- TTRACE_LOG("traceMark:: disabled tag");
- }
+ else
+ TTRACE_LOG("traceMark:: disabled tag >> tag: %u tag_bit: %u", tag, *cur_enabled_tag);
+
#endif
}
-/*
+/* LCOV_EXCL_STOP */
+/*
* Tracing API for tracing change of integer counter value: traceCounter
* - tag: the tracing tag
* - name: the event name
* - value: the value tracing
*/
-inline void traceCounter(int tag, int value, const char* name, ...) {
- if(isTagEnabled(tag)) {
+inline void traceCounter(int tag, int value, const char *name, ...)
+{
+ if (isTagEnabled(tag)) {
char buf[MAX_LEN];
int len = 0;
va_list ap;
va_start(ap, name);
len = snprintf(buf, MAX_LEN, "C|%d|", getpid());
- len += vsnprintf(buf+len, MAX_LEN-len, name, ap);
- len += snprintf(buf+len, MAX_LEN-len, "|%d", value);
+ len += vsnprintf(buf + len, MAX_LEN - len, name, ap);
+ len += snprintf(buf + len, MAX_LEN - len, "|%d", value);
write(g_trace_handle_fd, buf, len);
}
#ifdef TTRACE_DEBUG
- else {
+ else
TTRACE_LOG("traceCounter:: disabled tag");
- }
+
#endif
}
-/*
+/*
* Tracing API for Native Application
* - tag: the tracing tag
* - name: the event name
* - value: the value tracing
*/
-inline void trace_begin(const char *name, ...) {
+inline void trace_begin(const char *name, ...)
+{
va_list ap;
char v_name[MAX_LEN];
va_start(ap, name);
vsnprintf(v_name, MAX_LEN, name, ap);
-
+
traceBegin(TTRACE_TAG_APP, v_name);
va_end(ap);
}
-inline void trace_end() {
+
+inline void trace_end()
+{
traceEnd(TTRACE_TAG_APP);
}
-inline void trace_async_begin(int cookie, const char *name, ...) {
+
+inline void trace_async_begin(int cookie, const char *name, ...)
+{
va_list ap;
char v_name[MAX_LEN];
va_start(ap, name);
vsnprintf(v_name, MAX_LEN, name, ap);
-
+
traceAsyncBegin(TTRACE_TAG_APP, cookie, v_name);
va_end(ap);
}
-inline void trace_async_end(int cookie, const char *name, ...) {
+
+inline void trace_async_end(int cookie, const char *name, ...)
+{
va_list ap;
char v_name[MAX_LEN];
va_start(ap, name);
vsnprintf(v_name, MAX_LEN, name, ap);
-
+
traceAsyncEnd(TTRACE_TAG_APP, cookie, v_name);
va_end(ap);
}
-inline void trace_update_counter(int value, const char *name, ...) {
+
+inline void trace_update_counter(int value, const char *name, ...)
+{
va_list ap;
char v_name[MAX_LEN];
va_start(ap, name);
vsnprintf(v_name, MAX_LEN, name, ap);
-
+
traceCounter(TTRACE_TAG_APP, value, v_name);
va_end(ap);
}
#else
-inline void traceBegin(int tag, const char *name, ...) {;}
-inline void traceEnd(int tag) {;}
-inline void traceAsyncBegin(int tag, int cookie, const char *name, ...) {;}
-inline void traceAsyncEnd(int tag, int cookie, const char *name, ...) {;}
-inline void traceMark(int tag, const char *name, ...) {;}
-inline void traceCounter(int tag, int value, const char *name, ...) {;}
-inline void trace_begin(const char *name, ...) {;}
-inline void trace_end() {;}
-inline void trace_async_begin(int cookie, const char *name, ...) {;}
-inline void trace_async_end(int cookie, const char *name, ...) {;}
-inline void trace_update_counter(int value, const char *name, ...) {;}
+inline void traceBegin(int tag, const char *name, ...)
+{; }
+
+inline void traceEnd(int tag)
+{; }
+
+inline void traceAsyncBegin(int tag, int cookie, const char *name, ...)
+{; }
+
+inline void traceAsyncEnd(int tag, int cookie, const char *name, ...)
+{; }
+
+inline void traceMark(int tag, const char *name, ...)
+{; }
+
+inline void traceCounter(int tag, int value, const char *name, ...)
+{; }
+
+inline void trace_begin(const char *name, ...)
+{; }
+
+inline void trace_end()
+{; }
+
+inline void trace_async_begin(int cookie, const char *name, ...)
+{; }
+
+inline void trace_async_end(int cookie, const char *name, ...)
+{; }
+
+inline void trace_update_counter(int value, const char *name, ...)
+{; }
#endif
+
<define>
<domain name="ttrace" policy="restricted"/>
<request>
- <smack request="ttrace" type="rw"/>
+ <smack request="sdbd" type="r" />
</request>
- <permit>
- <smack permit="sdbd" type="rx"/>
- <smack permit="e17" type="rw"/>
- <smack permit="cbhm" type="rw"/>
- <smack permit="starter" type="rw"/>
- <smack permit="ui-gadget::client" type="rw"/>
- <smack permit="org.tizen.quickpanel" type="rw"/>
- <smack permit="org.tizen.indicator" type="rw"/>
- <smack permit="org.tizen.setting" type="rw"/>
- <smack permit="org.tizen.camera-app" type="rw"/>
- <smack permit="org.tizen.calendar" type="rw"/>
- <smack permit="org.tizen.music-player" type="rw"/>
- <smack permit="org.tizen.message" type="rw"/>
- <smack permit="org.tizen.browser" type="rw"/>
- </permit>
</define>
<assign>
- <filesystem path="/usr/bin/atrace-1.1" label="ttrace" exec_label="ttrace"/>
+ <filesystem path="/usr/bin/atrace" label="_" exec_label="ttrace" />
+ <filesystem path="/usr/bin/atrace-1.1" label="_" exec_label="ttrace" />
+ <filesystem path="/etc/ttrace/ttrace_tag" label="*" exec_label="none" />
+ <filesystem path="/usr/bin/exec-ttrace-marker" label="_" exec_label="ttrace" />
</assign>
<request>
<domain name="_"/>