From: Nikita Kalyazin Date: Thu, 31 Oct 2013 10:07:26 +0000 (+0400) Subject: [IMPROVE] add cache for pid X-Git-Tag: Tizen_SDK_2.3~124 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=b74a6adfc4e8a93e93eaa8254d23a2776449ed32;p=platform%2Fcore%2Fsystem%2Fswap-probe.git [IMPROVE] add cache for pid As it's done for tid Change-Id: Ieecf7ce5cc7f82bd1a9e1ad3bc078278152ab573 Signed-off-by: Nikita Kalyazin --- diff --git a/helper/libdaprobe.c b/helper/libdaprobe.c index 01f8a78..8ed1dfb 100755 --- a/helper/libdaprobe.c +++ b/helper/libdaprobe.c @@ -66,6 +66,7 @@ __thread int gProbeBlockCount = 0; __thread int gProbeDepth = 0; +pid_t gPid = -1; __thread pid_t gTid = -1; int g_timerfd = 0; @@ -184,6 +185,14 @@ static int determineCaller(char* tracestring) } } +// return current process id +static pid_t _getpid() +{ + if (gPid == -1) + gPid = getpid(); + return gPid; +} + // return current thread id static pid_t _gettid() { @@ -761,7 +770,7 @@ bool setProbePoint(probeInfo_t* iProbe) real_pthread_mutex_unlock(&(gTraceInfo.index.eventMutex)); iProbe->currentTime = getCurrentTime(); - iProbe->pID = getpid(); + iProbe->pID = _getpid(); iProbe->tID = _gettid(); iProbe->callDepth = gProbeDepth;