Understand. I am more tend to have tid along with pid. It helps to identify the association of tids in process contexts too esp. when the tid's are been reused on process restarts etc.
Thanks, Ramesh. On 3/15/2017 3:36 PM, Hans Nordebäck wrote: > Hi Ramesh, > > reading the trace files with tid instead of pid will make it much > easier to follow each threads flow of control. > > Tools such as trace2dot should also benefit. > > Example: > : > > Mar 15 10:57:54.837368 osafamfd > [475:src/imm/agent/imma_oi_api.cc:2960] TR attr:safCSIComp > Mar 15 10:57:54.837459 osafamfd > [475:src/imm/agent/imma_oi_api.cc:2960] TR attr:saAmfCSICompHAState > Mar 15 10:57:54.837510 osafamfd > [475:src/imm/agent/imma_oi_api.cc:2960] TR > attr:saAmfCSICompHAReadinessState > Mar 15 10:57:54.839783 osafamfd [477:src/amf/amfd/timer.cc:0154] >> > avd_tmr_exp > Mar 15 10:57:54.839909 osafamfd [477:src/amf/amfd/timer.cc:0175] << > avd_tmr_exp > Mar 15 10:57:54.840535 osafamfd [478:src/mds/mds_dt_trans.c:0608] >> > mdtm_process_poll_recv_data_tcp > > and e.g.: > > grep 'osafamfd \[475' osafamfd > amfd_475_trace > > grep 'osafamfd \[477' osafamfd > amfd_477_trace > > etc. we can have one trace file per thread. > > /Regards Hans > > On 03/15/2017 10:49 AM, ramesh betham wrote: >> Is there any requirement/necessity came across to know the "tid' in >> log info?. >> >> In general 'pid' is something commonly referred specific to process. >> Referring tid in some logs and pid in some other logs may lead to >> confusion while debugging. >> >> How about having both pid:tid values? >> >> Thanks, >> Ramesh. >> >> On 3/14/2017 8:59 PM, Anders Widell wrote: >>> Ack. >>> >>> regards, >>> >>> Anders Widell >>> >>> >>> On 03/13/2017 01:16 PM, Hans Nordeback wrote: >>>> src/base/logtrace.c | 7 ++++++- >>>> 1 files changed, 6 insertions(+), 1 deletions(-) >>>> >>>> >>>> Even though not being LSB it would be good to use thread id instead >>>> of process id in trace. >>>> >>>> diff --git a/src/base/logtrace.c b/src/base/logtrace.c >>>> --- a/src/base/logtrace.c >>>> +++ b/src/base/logtrace.c >>>> @@ -48,6 +48,11 @@ static const char *ident; >>>> static const char *pathname; >>>> static int logmask; >>>> +static pid_t gettid(void) >>>> +{ >>>> + return syscall(SYS_gettid); >>>> +} >>>> + >>>> /** >>>> * USR2 signal handler to enable/disable trace (toggle) >>>> * @param sig >>>> @@ -100,7 +105,7 @@ void output_(const char *file, unsigned >>>> i = snprintf(preamble, sizeof(preamble), "%s.%06ld %s ", >>>> log_string, tv.tv_usec, ident); >>>> snprintf(&preamble[i], sizeof(preamble) - i, "[%d:%s:%04u] >>>> %s %s", >>>> - getpid(), file, line, prefix_name[priority + category], >>>> format); >>>> + gettid(), file, line, prefix_name[priority + category], >>>> format); >>>> i = vsnprintf(log_string, sizeof(log_string), preamble, ap); >>>> /* Check if the logtrace user had passed message length >= >>>> logtrace array limit of 1023. >>> >> > ------------------------------------------------------------------------------ Check out the vibrant tech community on one of the world's most engaging tech sites, Slashdot.org! http://sdm.link/slashdot _______________________________________________ Opensaf-devel mailing list Opensaf-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/opensaf-devel