From 08bd3af7d247eb9ded5de33980ef80eac2274afe Mon Sep 17 00:00:00 2001 From: Nikita Kalyazin Date: Sun, 7 Jul 2013 17:22:19 +0400 Subject: [PATCH] [IMPROVE] send log messages to manager - log messages are sent to manager insead of regular file; - OPT_FUNC option removed; - OPT_* reordered according the protocol. Notice: Since this version da-probe will not work with Tizen SDK 2.1! --- helper/libdaprobe.c | 14 -------------- include/binproto.h | 25 ++++--------------------- include/probeinfo.h | 16 +++++++--------- 3 files changed, 11 insertions(+), 44 deletions(-) diff --git a/helper/libdaprobe.c b/helper/libdaprobe.c index f3a8e51..3ac2341 100755 --- a/helper/libdaprobe.c +++ b/helper/libdaprobe.c @@ -81,15 +81,6 @@ static void _configure(char* configstr) sprintf(buf, "configure in probe : %s, %lx\n", configstr, gTraceInfo.optionflag); PRINTMSG(buf); - - if(isOptionEnabled(OPT_FUNC)) - { - __profil(1); - } - else - { - __profil(0); - } } // create socket to daemon and connect @@ -367,15 +358,10 @@ void __attribute__((constructor)) _init_probe() gTraceInfo.init_complete = 1; TRACE_STATE_UNSET(TS_INIT); - - OPEN_LOG(); } void __attribute__((destructor)) _fini_probe() { - if (log_fd > 0) { - close(log_fd); - } int i; TRACE_STATE_SET(TS_FINIT); diff --git a/include/binproto.h b/include/binproto.h index c49f680..cb2b71a 100644 --- a/include/binproto.h +++ b/include/binproto.h @@ -20,6 +20,9 @@ #include +#include +#include "dahelper.h" + #define MSG_PROBE_MEMORY 0x3001 #define MSG_PROBE_UICONTROL 0x3002 #define MSG_PROBE_UIEVENT 0x3003 @@ -296,23 +299,6 @@ static inline char *pack_args(char *to, const char *fmt, ...) BUF_PTR = pack_int32(BUF_PTR, api_type); \ } while (0) -#define LOG_PATH "/tmp/trace.bin" -#define OPEN_LOG() \ - do { \ - log_fd = creat(LOG_PATH, 0644); \ - if (log_fd == -1) { \ - exit(1); \ - } \ - } while (0) -#define CLOSE_LOG() \ - do { \ - if (log_fd > 0) { \ - close(log_fd); \ - } \ - } while (0) - - - #define LOCAL_BUF_SIZE 1024 #define PREPARE_LOCAL_BUF() \ char buf[LOCAL_BUF_SIZE]; \ @@ -323,7 +309,7 @@ static inline char *pack_args(char *to, const char *fmt, ...) #define MSG_HDR_LEN 20 #define FLUSH_LOCAL_BUF() \ *(uint32_t *)(buf + MSG_LEN_OFFSET) = (p - buf) - MSG_HDR_LEN; \ - write(log_fd, buf, p - buf); + send(gTraceInfo.socket.daemonSock, buf, (p - buf), 0); // =========================== post block macro =========================== @@ -336,9 +322,6 @@ static inline char *pack_args(char *to, const char *fmt, ...) } \ errno = (newerrno != 0) ? newerrno : olderrno -/* data */ -extern int log_fd; - /* int main(int argc, char **argv) */ /* { */ /* char buf[1024]; */ diff --git a/include/probeinfo.h b/include/probeinfo.h index 2a40cba..07bf30f 100755 --- a/include/probeinfo.h +++ b/include/probeinfo.h @@ -156,15 +156,13 @@ enum MessageType enum DaOptions { OPT_ALWAYSOFF = 0x00000000, - OPT_CPUMEM = 0x00000001, - OPT_FUNC = 0x00000002, - OPT_ALLOC = 0x00000004, - OPT_FILE = 0x00000008, - OPT_THREAD = 0x00000010, - OPT_UI = 0x00000020, - OPT_SNAPSHOT = 0x00000040, - OPT_EVENT = 0x00000080, - OPT_RECORD = 0x00000100, + OPT_ALLOC = 0x00000008, + OPT_FILE = 0x00000010, + OPT_THREAD = 0x00000020, + OPT_UI = 0x00000040, + OPT_SNAPSHOT = 0x00000080, + OPT_EVENT = 0x00000100, + OPT_RECORD = 0x00000200, OPT_ALWAYSON = 0x11111111 }; -- 2.7.4