diff options
author | Gihun Chang <gihun.chang@samsung.com> | 2016-11-03 08:52:28 +0900 |
---|---|---|
committer | Gihun Chang <gihun.chang@samsung.com> | 2016-11-03 08:52:28 +0900 |
commit | 5fa2f36a51ebd9eeadd0b1a68267dcceb0c9dabc (patch) | |
tree | 44a307308ed9d8eca4b8c6145612848ff45fb38e | |
parent | 16ea946ac9018e0d934a4b3ed6575550cb027f2a (diff) | |
parent | 98bcde28433a38318c72a4a7f03973904822916b (diff) | |
download | ttrace-5fa2f36a51ebd9eeadd0b1a68267dcceb0c9dabc.tar.gz ttrace-5fa2f36a51ebd9eeadd0b1a68267dcceb0c9dabc.tar.bz2 ttrace-5fa2f36a51ebd9eeadd0b1a68267dcceb0c9dabc.zip |
Merge branch 'tizen' into tizen_3.0submit/tizen_3.0_common/20161110.084657submit/tizen_3.0/20161102.235426accepted/tizen/3.0/wearable/20161103.044514accepted/tizen/3.0/tv/20161103.044456accepted/tizen/3.0/mobile/20161103.044434accepted/tizen/3.0/ivi/20161103.044534accepted/tizen/3.0/common/20161114.082701
-rwxr-xr-x | CMakeLists.txt | 2 | ||||
-rwxr-xr-x | packaging/ttrace.spec | 1 | ||||
-rwxr-xr-x | src/ttrace.c | 94 | ||||
-rw-r--r-- | ttrace.pc.in | 2 |
4 files changed, 25 insertions, 74 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index e5f4c4e..1a1abf6 100755 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -46,7 +46,7 @@ SET(HEADERS_ttrace ttrace.h trace.h) INCLUDE(FindPkgConfig) -pkg_check_modules(pkg_ttrace REQUIRED dlog capi-base-common ttrace-extension-static) +pkg_check_modules(pkg_ttrace REQUIRED dlog capi-base-common) FOREACH(flag ${pkg_ttrace_CFLAGS}) SET(EXTRA_CFLAGS_common "${EXTRA_CFLAGS_common} ${flag}") ENDFOREACH(flag) diff --git a/packaging/ttrace.spec b/packaging/ttrace.spec index 00be832..b317e06 100755 --- a/packaging/ttrace.spec +++ b/packaging/ttrace.spec @@ -12,7 +12,6 @@ BuildRequires: pkgconfig(dlog) BuildRequires: pkgconfig(zlib) BuildRequires: pkgconfig(capi-base-common) BuildRequires: pkgconfig(libsmack) -BuildRequires: pkgconfig(ttrace-extension-static) BuildRequires: cmake %define keepstatic 1 diff --git a/src/ttrace.c b/src/ttrace.c index 16b27ca..78c1218 100755 --- a/src/ttrace.c +++ b/src/ttrace.c @@ -18,7 +18,6 @@ #include "ttrace.h" #include "trace.h" #include "dlog.h" -#include "ttrace-extension.h" #define ENABLE_TTRACE @@ -53,12 +52,8 @@ #define FD_INITIAL_VALUE -1 #define TRACE_FILE_NOT_EXIST -2 -#define EXT_DEACTIVATED 0 -#define EXT_ACTIVATED 1 - int g_trace_handle_fd = FD_INITIAL_VALUE; int g_enabled_tag_fd = FD_INITIAL_VALUE; -int g_extension_state = EXT_DEACTIVATED; static uint64_t dummy = 0; uint64_t *cur_enabled_tag = (void *)&dummy; @@ -68,7 +63,6 @@ static uint64_t traceInit() uint64_t *sm_for_enabled_tag; TTRACE_LOG("traceInit: %p %p", cur_enabled_tag, ((void *)&dummy)); - g_extension_state = EXT_ACTIVATED; if (cur_enabled_tag == ((void *)&dummy)) { g_enabled_tag_fd = open(ENABLED_TAG_FILE, O_RDONLY | O_CLOEXEC); if (g_enabled_tag_fd < 0) { @@ -102,8 +96,6 @@ static uint64_t traceInit() } TTRACE_LOG("traceInit:: cur_enabled_tag >> %u", *cur_enabled_tag); - /* ttrace is ready. deactive g_extension_state */ - g_extension_state = EXT_DEACTIVATED; return *cur_enabled_tag; } @@ -123,7 +115,7 @@ static inline uint64_t isTagEnabled(uint64_t cur_tag) int check_params(int fd, char* buf, int len, const char* func) { if (fd <= 0 || buf == NULL || len < 0) { - fprintf(stderr, "Currupted arguments, fd: %d, buf: %p, len: %d at %s.\n", + TTRACE_LOG("Currupted arguments, fd: %d, buf: %p, len: %d at %s.\n", fd, buf, len, func); return -1; } @@ -137,7 +129,7 @@ int check_params(int fd, char* buf, int len, const char* func) */ void traceBegin(uint64_t tag, const char *name, ...) { - if (isTagEnabled(tag) || g_extension_state == EXT_ACTIVATED) { + if (isTagEnabled(tag)) { char buf[MAX_LEN]; int len = MAX_HEAD_LEN, ret = 0; va_list ap; @@ -148,30 +140,24 @@ void traceBegin(uint64_t tag, const char *name, ...) snprintf(buf, MAX_LEN, "B|%5d|", getpid()); len += vsnprintf(buf + MAX_HEAD_LEN, POS_LABEL_ST, name, ap); va_end(ap); - + if (len > MAX_LEN) len = MAX_LEN - 1; if (check_params(g_trace_handle_fd, buf, len, __func__) < 0) return; - if (g_extension_state == EXT_ACTIVATED) ttrace_extension_write(buf, len); - else ret = write(g_trace_handle_fd, buf, len); -#ifdef TTRACE_DEBUG + ret = write(g_trace_handle_fd, buf, len); if (ret < 0) - fprintf(stderr, "error writing, len: %d, ret: %d, errno: %d at traceBegin.\n", + TTRACE_LOG("error writing, len: %d, ret: %d, errno: %d at traceBegin.\n", len, ret, errno); -#endif } -#ifdef TTRACE_DEBUG - else { + else TTRACE_LOG("traceBegin:: disabled tag >> tag: %u tag_bit: %u", tag, *cur_enabled_tag); - -#endif } void traceEnd(uint64_t tag) { - if (isTagEnabled(tag) || g_extension_state == EXT_ACTIVATED) { + if (isTagEnabled(tag)) { int ret = 0; int len = 1; char end = 'E'; @@ -180,19 +166,13 @@ void traceEnd(uint64_t tag) if (check_params(g_trace_handle_fd, &end, len, __func__) < 0) return; - if (g_extension_state == EXT_ACTIVATED) ttrace_extension_write(&end, len); - else ret = write(g_trace_handle_fd, &end, len); -#ifdef TTRACE_DEBUG + ret = write(g_trace_handle_fd, &end, len); if (ret < 0) - fprintf(stderr, "error writing, len: %d, ret: %d, errno: %d at traceEnd.\n", + TTRACE_LOG("error writing, len: %d, ret: %d, errno: %d at traceEnd.\n", len, ret, errno); -#endif } -#ifdef TTRACE_DEBUG else TTRACE_LOG("traceEnd:: disabled tag >> tag: %u tag_bit: %u", tag, *cur_enabled_tag); - -#endif } /* @@ -204,7 +184,7 @@ void traceEnd(uint64_t tag) */ void traceAsyncBegin(uint64_t tag, int32_t cookie, const char *name, ...) { - if (isTagEnabled(tag) || g_extension_state == EXT_ACTIVATED) { + if (isTagEnabled(tag)) { char buf[MAX_LEN]; int len = MAX_HEAD_LEN, ret = 0; va_list ap; @@ -226,24 +206,18 @@ void traceAsyncBegin(uint64_t tag, int32_t cookie, const char *name, ...) if (check_params(g_trace_handle_fd, buf, len, __func__) < 0) return; - if (g_extension_state == EXT_ACTIVATED) ttrace_extension_write(buf, len); - else ret = write(g_trace_handle_fd, buf, len); -#ifdef TTRACE_DEBUG + ret = write(g_trace_handle_fd, buf, len); if (ret < 0) - fprintf(stderr, "error writing, len: %d, ret: %d, errno: %d at traceAsyncBegin.\n", + TTRACE_LOG("error writing, len: %d, ret: %d, errno: %d at traceAsyncBegin.\n", len, ret, errno); -#endif } -#ifdef TTRACE_DEBUG else TTRACE_LOG("traceAsyncBegin:: disabled tag >> tag: %u tag_bit: %u", tag, *cur_enabled_tag); - -#endif } void traceAsyncEnd(uint64_t tag, int32_t cookie, const char *name, ...) { - if (isTagEnabled(tag) || g_extension_state == EXT_ACTIVATED) { + if (isTagEnabled(tag)) { char buf[MAX_LEN]; int len = MAX_HEAD_LEN, ret = 0; va_list ap; @@ -265,19 +239,13 @@ void traceAsyncEnd(uint64_t tag, int32_t cookie, const char *name, ...) if (check_params(g_trace_handle_fd, buf, len, __func__) < 0) return; - if (g_extension_state == EXT_ACTIVATED) ttrace_extension_write(buf, len); - else ret = write(g_trace_handle_fd, buf, len); -#ifdef TTRACE_DEBUG + ret = write(g_trace_handle_fd, buf, len); if (ret < 0) - fprintf(stderr, "error writing, len: %d, ret: %d, errno: %d at traceAsyncEnd.\n", + TTRACE_LOG("error writing, len: %d, ret: %d, errno: %d at traceAsyncEnd.\n", len, ret, errno); -#endif } -#ifdef TTRACE_DEBUG else TTRACE_LOG("traceAsyncEnd:: disabled tag >> tag: %u tag_bit: %u", tag, *cur_enabled_tag); - -#endif } /* @@ -288,7 +256,7 @@ void traceAsyncEnd(uint64_t tag, int32_t cookie, const char *name, ...) /* LCOV_EXCL_START */ void traceMark(uint64_t tag, const char *name, ...) { - if (isTagEnabled(tag) || g_extension_state == EXT_ACTIVATED) { + if (isTagEnabled(tag)) { char buf[MAX_LEN], end = 'E'; int len = MAX_HEAD_LEN, ret = 0; va_list ap; @@ -304,31 +272,21 @@ void traceMark(uint64_t tag, const char *name, ...) if (check_params(g_trace_handle_fd, buf, len, __func__) < 0) return; - if (g_extension_state == EXT_ACTIVATED) ttrace_extension_write(buf, len); - else ret = write(g_trace_handle_fd, buf, len); - -#ifdef TTRACE_DEBUG + ret = write(g_trace_handle_fd, buf, len); if (ret < 0) - fprintf(stderr, "error writing, len: %d, ret: %d, errno: %d at traceMark.\n", + TTRACE_LOG("error writing, len: %d, ret: %d, errno: %d at traceMark.\n", len, ret, errno); -#endif len = 1; if (check_params(g_trace_handle_fd, &end, len, __func__) < 0) return; - if (g_extension_state == EXT_ACTIVATED) ttrace_extension_write(&end, len); - else ret = write(g_trace_handle_fd, &end, len); -#ifdef TTRACE_DEBUG + ret = write(g_trace_handle_fd, &end, len); if (ret < 0) - fprintf(stderr, "error writing, len: %d, ret: %d, errno: %d at traceMark.\n", + TTRACE_LOG("error writing, len: %d, ret: %d, errno: %d at traceMark.\n", len, ret, errno); -#endif } -#ifdef TTRACE_DEBUG else TTRACE_LOG("traceMark:: disabled tag >> tag: %u tag_bit: %u", tag, *cur_enabled_tag); - -#endif } /* LCOV_EXCL_STOP */ @@ -340,7 +298,7 @@ void traceMark(uint64_t tag, const char *name, ...) */ void traceCounter(uint64_t tag, int32_t value, const char *name, ...) { - if (isTagEnabled(tag) || g_extension_state == EXT_ACTIVATED) { + if (isTagEnabled(tag)) { char buf[MAX_LEN]; int len = MAX_HEAD_LEN, ret = 0; va_list ap; @@ -362,19 +320,13 @@ void traceCounter(uint64_t tag, int32_t value, const char *name, ...) if (check_params(g_trace_handle_fd, buf, len, __func__) < 0) return; - if (g_extension_state == EXT_ACTIVATED) ttrace_extension_write(buf, len); - else ret = write(g_trace_handle_fd, buf, len); -#ifdef TTRACE_DEBUG + ret = write(g_trace_handle_fd, buf, len); if (ret < 0) - fprintf(stderr, "error writing, len: %d, ret: %d, errno: %d at traceCounter.\n", + TTRACE_LOG("error writing, len: %d, ret: %d, errno: %d at traceCounter.\n", len, ret, errno); -#endif } -#ifdef TTRACE_DEBUG else TTRACE_LOG("traceCounter:: disabled tag"); - -#endif } #else diff --git a/ttrace.pc.in b/ttrace.pc.in index 5869688..709639e 100644 --- a/ttrace.pc.in +++ b/ttrace.pc.in @@ -8,6 +8,6 @@ includedir=@INCLUDEDIR@ Name: ttrace Description: T-trace for tizen Version: @VERSION@ -Requires: dlog ttrace-extension +Requires: dlog Libs: -L${libdir} -lttrace Cflags: -I${includedir} |