X-Git-Url: http://git.lttng.org./?a=blobdiff_plain;f=ltt%2Fbranches%2Fpoly%2Fltt%2Fevent.c;h=f762dbddf5d174e306175115682f4d94a8776444;hb=9d6cdb7be95c430c6ad61ffc7bff0f0942c95b71;hp=9b3ff0d9984b63155baaf14ab3c6b54fa4c90c45;hpb=cbd41522fece37839f38aaf3372b8a11fac9b267;p=lttv.git diff --git a/ltt/branches/poly/ltt/event.c b/ltt/branches/poly/ltt/event.c index 9b3ff0d9..f762dbdd 100644 --- a/ltt/branches/poly/ltt/event.c +++ b/ltt/branches/poly/ltt/event.c @@ -1,8 +1,12 @@ #include #include #include + #include "parser.h" +#include +#include "ltt-private.h" #include +#include /***************************************************************************** *Function name @@ -200,6 +204,11 @@ void ltt_event_position(LttEvent *e, LttEventPosition *ep) ep->tf = e->tracefile; } +LttEventPosition * ltt_event_position_new() +{ + return g_new(LttEventPosition, 1); +} + /***************************************************************************** *Function name * ltt_event_position_get : get the block number and index of the event @@ -243,8 +252,23 @@ void ltt_event_position_set(LttEventPosition *ep, ****************************************************************************/ unsigned ltt_event_cpu_id(LttEvent *e) -{ - return (unsigned)atoi(e->tracefile->name); +{ + char * c1, * c2, * c3; + c1 = strrchr(e->tracefile->name,'\\'); + c2 = strrchr(e->tracefile->name,'/'); + if(c1 == NULL && c2 == NULL){ + return (unsigned)atoi(e->tracefile->name); + }else if(c1 == NULL){ + c2++; + return (unsigned)atoi(c2); + }else if(c2 == NULL){ + c1++; + return (unsigned)atoi(c1); + }else{ + c3 = (c1 > c2) ? c1 : c2; + c3++; + return (unsigned)atoi(c3); + } } /*****************************************************************************