[FIX] cherry-pick a1a779f6e7dda81b331db36bb07068dd73022041 (#8:6) + merge
authorgreatim <jaewon81.lim@samsung.com>
Tue, 18 Jun 2013 08:32:09 +0000 (17:32 +0900)
committerAnastasia Lyupa <a.lyupa@samsung.com>
Mon, 22 Jul 2013 14:11:16 +0000 (18:11 +0400)
change method of probe block count

[Issue]

Change-Id: I97fb9a6885460f3edb3e2fef855d8251bebd2d6c

Conflicts:
helper/dahelper.c
probe_memory/libdamemalloc.c
probe_userfunc/libdauserfunc.c

helper/dacollection.c
helper/dahelper.c
helper/libdaprobe.c
include/dahelper.h
include/daprobe.h
probe_badaapi/bada_thread.cpp
probe_memory/libdamemalloc.c
probe_memory/libdanew.cpp
probe_userfunc/libdauserfunc.c

index 874c47f699f44db14fa3c0c3a89fb9f324389950..85bd1ca54f2a4300b49f957977f0b8274fff8f75 100755 (executable)
@@ -171,7 +171,7 @@ int find_symbol_hash(void* ptr, char** psymbol)
        if(unlikely(psymbol == NULL))
                return ERR_WRONGPARAMETER;
 
-       TRACE_STATE_SET(TS_HASHFUNC);
+       probeBlockStart();
 
        SYMBOLHASH_LOCK;
        k = kh_get(symbol, SYMBOLHASH, (uint32_t)ptr);
@@ -185,7 +185,7 @@ int find_symbol_hash(void* ptr, char** psymbol)
                ret = 1;
        }
        SYMBOLHASH_UNLOCK;
-       TRACE_STATE_UNSET(TS_HASHFUNC);
+       probeBlockEnd();
        return ret;
 }
 
@@ -206,7 +206,7 @@ int add_symbol_hash(void* ptr, const char* str, int strlen)
        if(unlikely(str == NULL))
                return ERR_WRONGPARAMETER;
 
-       TRACE_STATE_SET(TS_HASHFUNC);
+       probeBlockStart();
 
        SYMBOLHASH_LOCK;
        k = kh_put(symbol, SYMBOLHASH, (uint32_t)ptr, &rethash);
@@ -230,7 +230,7 @@ int add_symbol_hash(void* ptr, const char* str, int strlen)
                ret = 1;
        }
        SYMBOLHASH_UNLOCK;
-       TRACE_STATE_UNSET(TS_HASHFUNC);
+       probeBlockEnd();
        return ret;
 }
 
@@ -253,7 +253,7 @@ int add_memory_hash(void* ptr, size_t size, unsigned short type, unsigned short
        if(unlikely(ptr == NULL))
                return ERR_WRONGPARAMETER;
 
-       TRACE_STATE_SET(TS_HASHFUNC);
+       probeBlockStart();
        MEMORYHASH_LOCK;
        k = kh_put(allocmap, MEMORYHASH, (uint32_t)ptr, &rethash);
        if(likely(rethash != 0))        // succeed to add in hash table
@@ -274,7 +274,7 @@ int add_memory_hash(void* ptr, size_t size, unsigned short type, unsigned short
                ret = 1;
        }
        MEMORYHASH_UNLOCK;
-       TRACE_STATE_UNSET(TS_HASHFUNC);
+       probeBlockEnd();
        return ret;
 }
 
@@ -294,7 +294,7 @@ int del_memory_hash(void* ptr, unsigned short type, unsigned short* caller)
        if(unlikely(ptr == NULL))
                return ERR_WRONGPARAMETER;
 
-       TRACE_STATE_SET(TS_HASHFUNC);
+       probeBlockStart();
        MEMORYHASH_LOCK;
        k = kh_get(allocmap, MEMORYHASH, (uint32_t)ptr);
        if(likely(k != kh_end(MEMORYHASH)))
@@ -318,7 +318,7 @@ int del_memory_hash(void* ptr, unsigned short type, unsigned short* caller)
                ret = 1;        // there is not entry in hash table
        }
        MEMORYHASH_UNLOCK;
-       TRACE_STATE_UNSET(TS_HASHFUNC);
+       probeBlockEnd();
 
        return ret;
 }
@@ -346,7 +346,7 @@ int find_object_hash(void* ptr, char** type, char** classname)
        if(unlikely(classname == NULL))
                return ERR_WRONGPARAMETER;
 
-       TRACE_STATE_SET(TS_HASHFUNC);
+       probeBlockStart();
 
        OBJECTHASH_LOCK;
        k = kh_get(object, OBJECTHASH, (uint32_t)ptr);
@@ -361,7 +361,7 @@ int find_object_hash(void* ptr, char** type, char** classname)
                ret = 1;
        }
        OBJECTHASH_UNLOCK;
-       TRACE_STATE_UNSET(TS_HASHFUNC);
+       probeBlockEnd();
        return ret;
 }
 
@@ -383,7 +383,7 @@ int add_object_hash_class(void* ptr, const char* classname)
        if(unlikely(classname == NULL))
                return ERR_WRONGPARAMETER;
 
-       TRACE_STATE_SET(TS_HASHFUNC);
+       probeBlockStart();
 
        str_len = strlen(classname) + 1;
 
@@ -417,7 +417,7 @@ int add_object_hash_class(void* ptr, const char* classname)
                ret = 1;        // there is no entry
 
        OBJECTHASH_UNLOCK;
-       TRACE_STATE_UNSET(TS_HASHFUNC);
+       probeBlockEnd();
        return ret;
 }
 
@@ -439,7 +439,7 @@ int add_object_hash_type(void* ptr, const char* type)
        if(unlikely(type == NULL))
                return ERR_WRONGPARAMETER;
 
-       TRACE_STATE_SET(TS_HASHFUNC);
+       probeBlockStart();
 
        str_len = strlen(type) + 1;
 
@@ -477,7 +477,7 @@ int add_object_hash_type(void* ptr, const char* type)
                ret = 1;
 
        OBJECTHASH_UNLOCK;
-       TRACE_STATE_UNSET(TS_HASHFUNC);
+       probeBlockEnd();
        return ret;
 }
 
@@ -496,7 +496,7 @@ int del_object_hash(void* ptr)
        if(unlikely(ptr == NULL))
                return ERR_WRONGPARAMETER;
 
-       TRACE_STATE_SET(TS_HASHFUNC);
+       probeBlockStart();
        OBJECTHASH_LOCK;
        k = kh_get(object, OBJECTHASH, (uint32_t)ptr);
        if(likely(k != kh_end(OBJECTHASH)))             // there is entry in hash table
@@ -512,7 +512,7 @@ int del_object_hash(void* ptr)
                ret = 1;
        }
        OBJECTHASH_UNLOCK;
-       TRACE_STATE_UNSET(TS_HASHFUNC);
+       probeBlockEnd();
 
        return ret;
 }
@@ -537,7 +537,7 @@ int add_detector_hash(void* ptr, void* listener)
        if(unlikely(listener == NULL))
                return ERR_WRONGPARAMETER;
 
-       TRACE_STATE_SET(TS_HASHFUNC);
+       probeBlockStart();
 
        DETECTORHASH_LOCK;
        k = kh_put(detector, DETECTORHASH, (uint32_t)ptr, &rethash);
@@ -551,7 +551,7 @@ int add_detector_hash(void* ptr, void* listener)
                ret = 1;
        }
        DETECTORHASH_UNLOCK;
-       TRACE_STATE_UNSET(TS_HASHFUNC);
+       probeBlockEnd();
        return ret;
 }
 
@@ -569,7 +569,7 @@ int del_detector_hash(void* ptr)
        if(unlikely(ptr == NULL))
                return ERR_WRONGPARAMETER;
 
-       TRACE_STATE_SET(TS_HASHFUNC);
+       probeBlockStart();
        DETECTORHASH_LOCK;
        k = kh_get(detector, DETECTORHASH, (uint32_t)ptr);
        if(likely(k != kh_end(DETECTORHASH)))           // there is entry in hash table
@@ -581,7 +581,7 @@ int del_detector_hash(void* ptr)
                ret = 1;
        }
        DETECTORHASH_UNLOCK;
-       TRACE_STATE_UNSET(TS_HASHFUNC);
+       probeBlockEnd();
 
        return ret;
 }
index 1932da95bef11fa9c5d2d99b6dfacd289fcc2766..3ebd9814d07fa0e58456696d77574e6ca941783d 100755 (executable)
@@ -69,9 +69,6 @@ __traceInfo gTraceInfo =
        0                                                               // unsigned long optionflag
 };
 
-__thread unsigned long gSTrace = 0;
-
-
 void WcharToChar(char* pstrDest, const wchar_t* pwstrSrc)
 {
        int nLen=(int)wcslen(pwstrSrc);
@@ -109,4 +106,3 @@ int remove_indir(const char *dirname)
        return 0;
 }
 
-
index e4ba315c78f7a8cccfd2b7963f948ca3d97893ab..41546f0894abf77d209f33249644306612f378ae 100755 (executable)
@@ -59,9 +59,9 @@
 #define UDS_NAME                               "/tmp/da.socket"
 #define TIMERFD_INTERVAL               100000000               // 0.1 sec
 
-__thread int                   gProbeDepth = 0;
-__thread unsigned int  gProbeBlockCount = 0;
-__thread pid_t                 gTid = -1;
+__thread int           gProbeBlockCount = 0;
+__thread int           gProbeDepth = 0;
+__thread pid_t         gTid = -1;
 
 int                    g_timerfd = 0;
 long           g_total_alloc_size = 0;
@@ -197,7 +197,7 @@ static void* recvThread(void* data)
        if(gTraceInfo.socket.daemonSock == -1)
                return NULL;
 
-       TRACE_STATE_SET(TS_RECV_THREAD);
+       probeBlockStart();
 
        sigemptyset(&profsigmask);
        sigaddset(&profsigmask, SIGPROF);
@@ -291,7 +291,7 @@ static void* recvThread(void* data)
                }
        }
 
-       TRACE_STATE_UNSET(TS_RECV_THREAD);
+       probeBlockEnd();
        return NULL;
 }
 
@@ -304,7 +304,7 @@ void __attribute__((constructor)) _init_probe()
        struct timeval ttime;
        struct itimerspec ctime;
 
-       TRACE_STATE_SET(TS_INIT);
+       probeBlockStart();
 
        initialize_hash_table();
 
@@ -356,13 +356,13 @@ void __attribute__((constructor)) _init_probe()
        PRINTMSG("dynamic analyzer probe helper so loading...\n");
 
        gTraceInfo.init_complete = 1;
-       TRACE_STATE_UNSET(TS_INIT);
+       probeBlockEnd();
 }
 
 void __attribute__((destructor)) _fini_probe()
 {
        int i;
-       TRACE_STATE_SET(TS_FINIT);
+       probeBlockStart();
 
        gTraceInfo.init_complete = -1;
        PRINTMSG("dynamic analyzer probe helper so unloading...\n");
@@ -395,7 +395,7 @@ void __attribute__((destructor)) _fini_probe()
                }
        }
 
-       TRACE_STATE_UNSET(TS_FINIT);
+       probeBlockEnd();
 }
 
 
@@ -416,12 +416,12 @@ void __attribute__((destructor)) _fini_probe()
        if(unlikely(log == NULL))
                return false;
 
-       TRACE_STATE_SET(TS_PRINT_LOG);
+       probeBlockStart();
        log->type = msgType;
        pthread_mutex_lock(&(gTraceInfo.socket.sockMutex));
        res = send(gTraceInfo.socket.daemonSock, log, sizeof(log->type) + sizeof(log->length) + log->length, 0);
        pthread_mutex_unlock(&(gTraceInfo.socket.sockMutex));
-       TRACE_STATE_UNSET(TS_PRINT_LOG);
+       probeBlockEnd();
 
        return true;
 }*/
@@ -434,7 +434,7 @@ bool printLogStr(const char* str, int msgType)
        if(unlikely(gTraceInfo.socket.daemonSock == -1))
                return false;
 
-       TRACE_STATE_SET(TS_PRINT_LOG);
+       probeBlockStart();
 
        log.type = msgType;
        if(str)
@@ -451,7 +451,7 @@ bool printLogStr(const char* str, int msgType)
        res = send(gTraceInfo.socket.daemonSock, &log, sizeof(log.type) + sizeof(log.length) + log.length, MSG_DONTWAIT);
        pthread_mutex_unlock(&(gTraceInfo.socket.sockMutex));
 
-       TRACE_STATE_UNSET(TS_PRINT_LOG);
+       probeBlockEnd();
 
        return true;
 }
@@ -470,7 +470,7 @@ int __appendTypeLog(log_t* log, int nInput, char* token, ...)
        if(nInput <= 0 || log == NULL)
                return -1;
 
-       TRACE_STATE_SET(TS_APPEND_TYPE_LOG);
+       probeBlockStart();
 
        va_start(p_arg, token);
 
@@ -547,14 +547,14 @@ int __appendTypeLog(log_t* log, int nInput, char* token, ...)
                        break;*/
                default:
                        va_end(p_arg);
-                       TRACE_STATE_UNSET(TS_APPEND_TYPE_LOG);
+                       probeBlockEnd();
                        return -1;
                }
        }
 
        va_end(p_arg);
 
-       TRACE_STATE_UNSET(TS_APPEND_TYPE_LOG);
+       probeBlockEnd();
        return 0;
 }
 
@@ -572,7 +572,7 @@ int getBacktraceString(log_t* log, int bufsize)
        if(log == NULL)
                return 0;
 
-       TRACE_STATE_SET(TS_BACKTRACE);
+       probeBlockStart();
 
        initsize = log->length;
        log->data[log->length] = '\0';  // is this necessary ?
@@ -610,12 +610,12 @@ int getBacktraceString(log_t* log, int bufsize)
                        log->length -= 2;
                }
 
-               TRACE_STATE_UNSET(TS_BACKTRACE);
+               probeBlockEnd();
                return (int)(size - TRIM_STACK_DEPTH);
        }
        else
        {
-               TRACE_STATE_UNSET(TS_BACKTRACE);
+               probeBlockEnd();
                return 0;
        }
 }
@@ -629,7 +629,7 @@ int preBlockBegin(void* caller, bool bFiltering, enum DaOptions option)
        void* tarray[1];
        char** strings;
 
-       if(gSTrace != 0 || gProbeDepth != 0)
+       if(gProbeBlockCount != 0 || gProbeDepth != 0)
                return 0;
 
        if(gTraceInfo.init_complete <= 0)
@@ -638,7 +638,7 @@ int preBlockBegin(void* caller, bool bFiltering, enum DaOptions option)
        if((gTraceInfo.optionflag & option) == 0)
                return 0;
 
-       TRACE_STATE_SET(TS_ENTER_PROBE_BLOCK);
+       probeBlockStart();
 
        if(gTraceInfo.exec_map.map_start != NULL)
        {
@@ -672,19 +672,19 @@ int preBlockBegin(void* caller, bool bFiltering, enum DaOptions option)
 
        if(user)
        {
-               gProbeDepth++;
+               probingStart();
                return 2;       // user call
        }
        else
        {
                if(bFiltering)
                {
-                       TRACE_STATE_UNSET(TS_ENTER_PROBE_BLOCK);
+                       probeBlockEnd();
                        return 0;       // not probing
                }
                else
                {
-                       gProbeDepth++;
+                       probingStart();
                        return 1;       // internal call
                }
        }
@@ -694,7 +694,7 @@ int postBlockBegin(int preresult)
 {
        if(preresult)
        {
-               TRACE_STATE_SET(TS_ENTER_PROBE_BLOCK);
+               probeBlockStart();
        }
 
        return preresult;
@@ -702,28 +702,13 @@ int postBlockBegin(int preresult)
 
 void preBlockEnd()
 {
-       TRACE_STATE_UNSET(TS_ENTER_PROBE_BLOCK);
+       probeBlockEnd();
 }
 
 void postBlockEnd()
 {
-       gProbeDepth--;
-       TRACE_STATE_UNSET(TS_ENTER_PROBE_BLOCK);
-}
-
-// for block that have to be run
-void probeBlockStart()
-{
-       gProbeBlockCount++;
-       if(gProbeBlockCount == 1)
-               TRACE_STATE_SET(TS_PROBE);
-}
-
-void probeBlockEnd()
-{
-       if(gProbeBlockCount == 1)
-               TRACE_STATE_UNSET(TS_PROBE);
-       gProbeBlockCount--;
+       probingEnd();
+       probeBlockEnd();
 }
 
 /*************************************************************************
@@ -744,16 +729,6 @@ unsigned int getCurrentEventIndex()
        return gTraceInfo.index.eventIndex;
 }
 
-unsigned int getCallDepth()
-{
-       return gProbeDepth;
-}
-
-unsigned long getTraceState()
-{
-       return gSTrace;
-}
-
 /************************************************************************
  * probe functions
  ************************************************************************/
@@ -764,7 +739,7 @@ bool setProbePoint(probeInfo_t* iProbe)
                return false;
        }
 
-       TRACE_STATE_SET(TS_SET_PROBE_POINT);
+       probeBlockStart();
 
        // atomic operaion(gcc builtin) is more expensive then pthread_mutex
        pthread_mutex_lock(&(gTraceInfo.index.eventMutex));     
@@ -776,7 +751,7 @@ bool setProbePoint(probeInfo_t* iProbe)
        iProbe->tID = _gettid();
        iProbe->callDepth = gProbeDepth;
 
-       TRACE_STATE_UNSET(TS_SET_PROBE_POINT);
+       probeBlockEnd();
        return true;
 }
 
index 92ee9cc1bc8d817a8267523caca0e247c535a762..ad08d7e5150c0ed6e3e3c8a5b35168f932331514 100755 (executable)
@@ -56,27 +56,6 @@ extern "C"{
 #define SNAPSHOT_WAIT_TIME_MAX 10000
 */
 
-#define TS_NONE                                                0x00000000
-#define TS_PROBE                                       0x00000001
-#define TS_INIT                                                0x00000002
-#define TS_FINIT                                       0x00000004
-#define TS_ENTER_PROBE_BLOCK           0x00000008
-#define TS_SET_PROBE_POINT                     0x00000010
-#define TS_PRINT_LOG                           0x00000020
-#define TS_PRINT_SAMPLE_LOG                    0x00000040
-#define TS_APPEND_TYPE_LOG                     0x00000080
-#define TS_BACKTRACE                           0x00000100
-#define TS_HASHFUNC                                    0x00000200
-#define TS_PROFIL_THREAD                       0x00000400
-#define TS_PROFIL_COUNT                                0x00000800
-#define TS_DETECT_TOUCH                                0x00001000
-#define TS_REGIST_SCREEN_CHANGE                0x00002000
-#define TS_POSSIBLE_CAPTURE                    0x00004000
-#define TS_RECV_THREAD                         0x00008000
-#define TS_CUSTOM_CHART_THREAD         0x00010000
-#define TRACE_STATE_SET(value)         ((gSTrace) |= (value))
-#define TRACE_STATE_UNSET(value)       ((gSTrace) &= (~value))
-
 #define ENABLE_INTERNAL_MALLOC         0x0001
 #define ENABLE_SNAPSHOT                                0x0002
 
@@ -224,7 +203,6 @@ typedef struct
        unsigned long           optionflag;
 } __traceInfo;
 
-extern __thread unsigned long  gSTrace;
 extern __traceInfo gTraceInfo;
 
 int get_map_address(void* symbol, void** map_start, void** map_end);
index 1a860621a3ac5cce0bccc32ac2f0a5ac786d6c2d..c11d484d16d1594974a5465370fb29a343e64e02 100644 (file)
@@ -88,6 +88,14 @@ typedef struct
        unsigned int    callDepth;
 } probeInfo_t;
 
+extern __thread int    gProbeBlockCount;
+extern __thread int    gProbeDepth;
+
+#define probeBlockStart()      (gProbeBlockCount++)
+#define probeBlockEnd()                (gProbeBlockCount--)
+#define probingStart()         (gProbeDepth++)
+#define probingEnd()           (gProbeDepth--)
+
 /***************************************************************************
  * helper apis
  ***************************************************************************/
@@ -98,12 +106,7 @@ void preBlockEnd();
 int postBlockBegin(int preresult);
 void postBlockEnd();
 
-void probeBlockStart();
-void probeBlockEnd();
-
 unsigned int getCurrentEventIndex();
-unsigned int getCallDepth();
-unsigned long getTraceState();
 unsigned long getCurrentTime();
 bool setProbePoint(probeInfo_t * iProbe);
 int update_heap_memory_size(bool isAdd, size_t size);
index 42458a4f3ec8a76b261565a9f65fffee800eeaef..1ed2ffeb3ae4212565d9f10c64ec448db40f98ea 100755 (executable)
@@ -44,8 +44,6 @@
 
 static enum DaOptions _sopt = OPT_THREAD;
 
-extern __thread int gProbeDepth;
-
 namespace Tizen {
 namespace Base {
 namespace Runtime {
@@ -266,11 +264,11 @@ _ThreadImpl::ThreadProc(void* params) {
                preBlockEnd();
        }
        // all probe should be reachable inside thread start_routine (user implemented Thread::Run)
-       gProbeDepth--;
-       TRACE_STATE_UNSET(TS_ENTER_PROBE_BLOCK);
+       probingEnd();
+       probeBlockEnd();
        (ThreadProcp)(params);
-       TRACE_STATE_SET(TS_ENTER_PROBE_BLOCK);
-       gProbeDepth++;
+       probeBlockStart();
+       probingStart();
        //
        if (postBlockBegin(blockresult)) {
                setProbePoint(&probeInfo);
index feadb4ca556bcdb464d3bc432d3146673f390ec7..2edd925d149ef1b237ce41c03bdeaa5f46fd2882 100755 (executable)
@@ -86,7 +86,7 @@ static void *malloc_hook(size_t size, const void* caller)
 
        pret = malloc(size);
 
-       if(pret != NULL && getTraceState() == 0)
+       if(pret != NULL && gProbeBlockCount == 0)
        {
                add_memory_hash(pret, size, MEMTYPE_ALLOC, blockresult ? MEM_EXTERNAL : MEM_INTERNAL);
        }
@@ -116,7 +116,7 @@ static void free_hook(void *ptr, const void *caller)
 
        PRE_PROBEBLOCK();
 
-       if(ptr != NULL && getTraceState() == 0)
+       if(ptr != NULL && gProbeBlockCount == 0)
        {
                del_memory_hash(ptr, MEMTYPE_FREE, NULL);
        }
@@ -147,14 +147,14 @@ static void* realloc_hook(void *memblock, size_t size, const void* caller)
 
        PRE_PROBEBLOCK();
 
-       if(memblock != NULL && getTraceState() == 0)
+       if(memblock != NULL && gProbeBlockCount == 0)
        {
                del_memory_hash(memblock, MEMTYPE_FREE, NULL);
        }
 
        pret = realloc(memblock, size);
 
-       if(pret != NULL && getTraceState() == 0)
+       if(pret != NULL && gProbeBlockCount == 0)
        {
                add_memory_hash(pret, size, MEMTYPE_ALLOC, blockresult ? MEM_EXTERNAL : MEM_INTERNAL);
        }
@@ -194,7 +194,7 @@ void *calloc(size_t nelem, size_t elsize)
        if (pret) /* `memset' somewhy deadloops */
                adhoc_bzero(pret, nelem * elsize);
 
-       if(pret != NULL && getTraceState() == 0)
+       if(pret != NULL && gProbeBlockCount == 0)
        {
                add_memory_hash(pret, nelem * elsize, MEMTYPE_ALLOC, blockresult ? MEM_EXTERNAL : MEM_INTERNAL);
     }
index f187d4c7b1b9b901b88ff7eeeaf52a6f566c3932..b4c48e8f84d9ab447bb44c7cd215338dc6dacd7e 100644 (file)
@@ -43,8 +43,6 @@
 #include "da_memory.h"
 #include "binproto.h"
 
-extern __thread int gProbeDepth;
-
 static enum DaOptions _sopt = OPT_ALLOC;
 
 void *operator new(std::size_t size) throw (std::bad_alloc)
@@ -60,7 +58,7 @@ void *operator new(std::size_t size) throw (std::bad_alloc)
 
        pret = newp(size);
 
-       if(pret != NULL && getTraceState() == 0)
+       if(pret != NULL && gProbeBlockCount == 0)
        {
                add_memory_hash(pret, size, MEMTYPE_NEW, blockresult ? MEM_EXTERNAL : MEM_INTERNAL);
        }
@@ -93,7 +91,7 @@ void *operator new[](std::size_t size) throw (std::bad_alloc)
 
        pret = newp(size);
 
-       if(pret != NULL && getTraceState() == 0)
+       if(pret != NULL && gProbeBlockCount == 0)
        {
                add_memory_hash(pret, size, MEMTYPE_NEW, blockresult ? MEM_EXTERNAL : MEM_INTERNAL);
        }
@@ -124,7 +122,7 @@ void operator delete(void *ptr) throw()
        bfiltering = INTERNAL_DELETE_FILTERING;
        PRE_PROBEBLOCK();
 
-       if(ptr != NULL && getTraceState() == 0)
+       if(ptr != NULL && gProbeBlockCount == 0)
        {
                probeBlockStart();
                ret = del_memory_hash(ptr, MEMTYPE_DELETE, &caller);
@@ -132,7 +130,7 @@ void operator delete(void *ptr) throw()
                {
                        setProbePoint(&probeInfo);
                        blockresult = 2;
-                       gProbeDepth++;
+                       probingStart();
                }
                probeBlockEnd();
        }
@@ -163,7 +161,7 @@ void operator delete[](void *ptr) throw()
        bfiltering = INTERNAL_DELETE_FILTERING;
        PRE_PROBEBLOCK();
 
-       if(ptr != NULL && getTraceState() == 0)
+       if(ptr != NULL && gProbeBlockCount == 0)
        {
                probeBlockStart();
                ret = del_memory_hash(ptr, MEMTYPE_DELETE, &caller);
@@ -171,7 +169,7 @@ void operator delete[](void *ptr) throw()
                {
                        setProbePoint(&probeInfo);
                        blockresult = 2;
-                       gProbeDepth++;
+                       probingStart();
                }
                probeBlockEnd();
        }
@@ -204,7 +202,7 @@ void *operator new(std::size_t size, const std::nothrow_t& nothrow) throw()
 
        pret = newp(size, nothrow);
 
-       if(pret != NULL && getTraceState() == 0)
+       if(pret != NULL && gProbeBlockCount == 0)
        {
                add_memory_hash(pret, size, MEMTYPE_NEW, blockresult ? MEM_EXTERNAL : MEM_INTERNAL);
        }
@@ -237,7 +235,7 @@ void *operator new[](std::size_t size, const std::nothrow_t& nothrow) throw()
 
        pret = newp(size, nothrow);
 
-       if(pret != NULL && getTraceState() == 0)
+       if(pret != NULL && gProbeBlockCount == 0)
        {
                add_memory_hash(pret, size, MEMTYPE_NEW, blockresult ? MEM_EXTERNAL : MEM_INTERNAL);
        }
@@ -268,7 +266,7 @@ void operator delete(void *ptr, const std::nothrow_t& nothrow) throw()
        bfiltering = INTERNAL_DELETE_FILTERING;
        PRE_PROBEBLOCK();
 
-       if(ptr != NULL && getTraceState() == 0)
+       if(ptr != NULL && gProbeBlockCount == 0)
        {
                probeBlockStart();
                ret = del_memory_hash(ptr, MEMTYPE_DELETE, &caller);
@@ -276,7 +274,7 @@ void operator delete(void *ptr, const std::nothrow_t& nothrow) throw()
                {
                        setProbePoint(&probeInfo);
                        blockresult = 2;
-                       gProbeDepth++;
+                       probingStart();
                }
                probeBlockEnd();
        }
@@ -307,7 +305,7 @@ void operator delete[](void *ptr, const std::nothrow_t& nothrow) throw()
        bfiltering = INTERNAL_DELETE_FILTERING;
        PRE_PROBEBLOCK();
 
-       if(ptr != NULL && getTraceState() == 0)
+       if(ptr != NULL && gProbeBlockCount == 0)
        {
                probeBlockStart();
                ret = del_memory_hash(ptr, MEMTYPE_DELETE, &caller);
@@ -315,7 +313,7 @@ void operator delete[](void *ptr, const std::nothrow_t& nothrow) throw()
                {
                        setProbePoint(&probeInfo);
                        blockresult = 2;
-                       gProbeDepth++;
+                       probingStart();
                }
                probeBlockEnd();
        }
index 4c3f148297caca418b1c3169716df2e0fd45d998..8b409dad3690d214fed33bbf17ab38a65334b61d 100755 (executable)
@@ -222,7 +222,7 @@ int profil_backtrace_symbols(log_t *log, int bufsize, int index)
 
 void *profil_log_func(void *data)
 {
-       TRACE_STATE_SET(TS_PROFIL_THREAD);
+       probeBlockStart();
        
        sigset_t profsigmask;
        sigemptyset(&profsigmask);
@@ -237,7 +237,7 @@ void *profil_log_func(void *data)
                }
                usleep(PROFIL_LOG_SENDING_INTERVAL_USEC);
        }
-       TRACE_STATE_UNSET(TS_PROFIL_THREAD);
+       probeBlockEnd();
 
        return NULL;
 }
@@ -378,10 +378,10 @@ static inline void profil_count(void *pc)
        if((pc >= (void*)(&profil_count - 0x18)) && (pc <= (void*)(&profil_count)))
                return;
 #endif
-       if(gSTrace != 0)
+       if(gProbeBlockCount != 0)
                return;
 
-       TRACE_STATE_SET(TS_PROFIL_COUNT);
+       probeBlockStart();
 
        real_pthread_mutex_lock(&profil_log_mutex);
        do {
@@ -415,7 +415,7 @@ static inline void profil_count(void *pc)
        } while(0);
        real_pthread_mutex_unlock(&profil_log_mutex);
 
-       TRACE_STATE_UNSET(TS_PROFIL_COUNT);
+       probeBlockEnd();
 }
 
 #if defined(__i386__)