#include <stdlib.h>
-#include "parser.h"
#include <ltt/ltt.h>
#include "ltt-private.h"
#include <ltt/trace.h>
#define PAGE_MASK (~(page_size-1))
#define PAGE_ALIGN(addr) (((addr)+page_size-1)&PAGE_MASK)
+LttTrace *father_trace = NULL;
+
/* set the offset of the fields belonging to the event,
need the information of the archecture */
//void set_fields_offsets(LttTracefile *tf, LttEventType *event_type);
tf->tsc_lsb_truncate = vheader->tsc_lsb_truncate;
tf->tscbits = vheader->tscbits;
tf->tsc_msb_cutoff = 32 - tf->tsc_lsb_truncate - tf->tscbits;
+ tf->compact_event_bits = 32 - vheader->compact_data_shift;
tf->tsc_mask = ((1ULL << (tf->tscbits))-1);
tf->tsc_mask = tf->tsc_mask << tf->tsc_lsb_truncate;
tf->tsc_mask_next_bit = (1ULL<<(tf->tscbits));
&vheader->start_freq);
t->freq_scale = ltt_get_uint32(LTT_GET_BO(tf),
&vheader->freq_scale);
+ if(father_trace) {
+ t->start_freq = father_trace->start_freq;
+ t->freq_scale = father_trace->freq_scale;
+ }
+ else {
+ father_trace = t;
+ }
t->start_tsc = ltt_get_uint64(LTT_GET_BO(tf),
&vheader->start_tsc);
t->start_monotonic = ltt_get_uint64(LTT_GET_BO(tf),
(double)t->start_tsc
* (1000000000.0 / tf->trace->freq_scale)
/ (double)t->start_freq);
- t->compact_event_bits = 0;
}
}
break;
perror("Error in allocating memory for buffer of tracefile");
goto close_file;
}
- g_assert( ( (guint)tf->buffer.head&(8-1) ) == 0); // make sure it's aligned.
+ g_assert( ( (gulong)tf->buffer.head&(8-1) ) == 0); // make sure it's aligned.
header = (struct ltt_block_start_header*)tf->buffer.head;
int get_tracefile_name_number(gchar *raw_name,
GQuark *name,
guint *num,
- guint *tid,
- guint *pgid,
+ gulong *tid,
+ gulong *pgid,
guint64 *creation)
{
guint raw_name_len = strlen(raw_name);
g_debug("Tracefile file or directory : %s\n", path);
- if(strcmp(rel_path, "/eventdefs") == 0) continue;
+ // if(strcmp(rel_path, "/eventdefs") == 0) continue;
if(S_ISDIR(stat_buf.st_mode)) {
if(ret < 0) continue;
} else if(S_ISREG(stat_buf.st_mode)) {
GQuark name;
- guint num, tid, pgid;
+ guint num;
+ gulong tid, pgid;
guint64 creation;
GArray *group;
- num = tid = pgid = 0;
+ num = 0;
+ tid = pgid = 0;
creation = 0;
if(get_tracefile_name_number(rel_path, &name, &num, &tid, &pgid, &creation))
continue; /* invalid name */
DIR *dir;
struct dirent *entry;
guint control_found = 0;
- guint eventdefs_found = 0;
struct stat stat_buf;
gchar path[PATH_MAX];
if(strcmp(entry->d_name, "control") == 0) {
control_found = 1;
}
- if(strcmp(entry->d_name, "eventdefs") == 0) {
- eventdefs_found = 1;
- }
}
}
closedir(dir);
- if(!control_found || !eventdefs_found) goto find_error;
+ if(!control_found) goto find_error;
/* Open all the tracefiles */
if(open_tracefiles(t, abs_path, "")) {
if (offset + ((i * 4) + j) <
(long)end_pos - (long)start_pos)
g_printf("%02hhX",
- ((char*)ev->tracefile->buffer.head)[ev->offset + offset + ((i * 4) + j)]);
+ ((char*)start_pos)[offset + ((i * 4) + j)]);
else
g_printf(" ");
g_printf(" ");
/* We keep the LSB of the previous timestamp, to make sure
* we never go back */
event->event_id = event->timestamp >> tf->tscbits;
- event->event_id = event->event_id & ((1 << tf->trace->compact_event_bits) - 1);
+ event->event_id = event->event_id & ((1 << tf->compact_event_bits) - 1);
event->compact_data = event->timestamp >>
- (tf->trace->compact_event_bits + tf->tscbits);
+ (tf->compact_event_bits + tf->tscbits);
//printf("tsc bits %u, ev bits %u init data %u\n",
// tf->tscbits, tf->trace->compact_event_bits, event->compact_data);
/* Put the compact data back in original endianness */
event->event_time = ltt_interpolate_time(tf, event);
if(!tf->compact) {
- event->event_id = *(guint16*)pos;
+ event->event_id = ltt_get_uint16(LTT_GET_BO(tf), pos);
pos += sizeof(guint16);
event->event_size = ltt_get_uint16(LTT_GET_BO(tf), pos);
pos += sizeof(guint16);
} else {
/* Compact event */
+ event->event_size = 0xFFFF;
}
if (a_event_debug)
g_assert(0);
goto map_error;
}
- g_assert( ( (guint)tf->buffer.head&(8-1) ) == 0); // make sure it's aligned.
+ g_assert( ( (gulong)tf->buffer.head&(8-1) ) == 0); // make sure it's aligned.
tf->buffer.index = block_num;
}
info = marker_get_info_from_id(tf->trace, tf->event.event_id);
+
if (tf->event.event_id >= MARKER_CORE_IDS)
g_assert(info != NULL);