****************************************************************************/
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);
+ }
}
/*****************************************************************************
LttTime lTimeOffset; // Time offset in struct LttTime
guint16 evId;
gint64 nanoSec, tmpCycleCount = (((guint64)1)<<32);
- static LttCycleCount preCycleCount = 0;
- static int count = 0;
evId = *(guint16 *)tf->cur_event_pos;
if(evId == TRACE_BLOCK_START){
- count = 0;
- preCycleCount = 0;
+ tf->count = 0;
+ tf->pre_cycle_count = 0;
tf->cur_cycle_count = tf->a_block_start->cycle_count;
return tf->a_block_start->time;
}else if(evId == TRACE_BLOCK_END){
- count = 0;
- preCycleCount = 0;
+ tf->count = 0;
+ tf->pre_cycle_count = 0;
tf->cur_cycle_count = tf->a_block_end->cycle_count;
return tf->a_block_end->time;
}
// Calculate total time in cycles from start of buffer for this event
cycle_count = (LttCycleCount)*(guint32 *)(tf->cur_event_pos + EVENT_ID_SIZE);
- if(cycle_count < preCycleCount)count++;
- preCycleCount = cycle_count;
- cycle_count += tmpCycleCount * count;
+ if(cycle_count < tf->pre_cycle_count)tf->count++;
+ tf->pre_cycle_count = cycle_count;
+ cycle_count += tmpCycleCount * tf->count;
- if(tf->cur_heart_beat_number > count)
- cycle_count += tmpCycleCount * (tf->cur_heart_beat_number - count);
+ if(tf->cur_heart_beat_number > tf->count)
+ cycle_count += tmpCycleCount * (tf->cur_heart_beat_number - tf->count);
tf->cur_cycle_count = cycle_count;