30 perror(
"Could not allocate memory for the trace header!");
39 perror(
"Could not read the trace header!");
56 header_size - general_header_size);
58 perror(
"Could not read the trace header!");
86 perror(
"Could not read the trace header!");
99 lseek(trace->
f_handle, offset, SEEK_SET);
111 "Could not read the next part of pairs (tid, offset) from the trace file!");
134 for (thread_index = 0; thread_index < process->
nb_threads; thread_index++) {
147 if ((thread_pair->
tid == 0) && (thread_pair->
offset != 0)) {
148 __litl_read_next_pairs_buffer(
154 if ((thread_pair->
tid == 0) && (thread_pair->
offset == 0))
171 perror(
"Could not read the first partition of data from the trace file!");
192 if ((trace->
f_handle = open(filename, O_RDONLY)) < 0) {
193 fprintf(stderr,
"Cannot open %s\n", filename);
198 __litl_read_init_trace_header(trace);
214 for (process_index = 0; process_index < trace->
nb_processes;
228 __litl_read_init_process_header(trace, trace->
processes[process_index]);
231 __litl_read_init_threads(trace, trace->
processes[process_index]);
287 perror(
"Could not read the next part of the trace file!");
303 for (thread_index = 0; thread_index < process->
nb_threads; thread_index++)
327 event = (
litl_t *) buffer;
346 if (remaining_size < event_size)
354 event->parameters.offset.offset;
365 __litl_read_next_buffer(trace, process, thread_index);
367 event = (
litl_t *) buffer;
392 for (thread_index = 0; thread_index < process->
nb_threads; thread_index++)
393 __litl_read_next_thread_event(trace, process, thread_index);
401 __litl_read_next_thread_event(trace, process, process->
cur_index);
404 for (thread_index = 0; thread_index < process->
nb_threads; thread_index++) {
428 for (process_index = 0; process_index < trace->
nb_processes;
451 for (process_index = 0; process_index < trace->
nb_processes;
454 for (thread_index = 0;
#define LITL_READ_GET_CUR_EVENT_PER_THREAD(process, thread_index)
Returns a current event of a given thread.
litl_buffer_t header_buffer_ptr
A data structure for reading events from both regular trace files and archives of traces...
#define LITL_MAX_PARAMS
Defines the maximum number of parameters.
A data structure for reading thread-specific events.
litl_read_trace_t * litl_read_open_trace(const char *filename)
Opens a trace and reads the first portion of data (trace header) to the buffer.
void litl_read_reset_process(litl_read_process_t *process)
Resets the trace pointer.
#define NBTHREADS
Defines the maximum number of threads (pairs of tid and offset) stored in one data slot...
litl_general_header_t * header
litl_process_header_t * litl_read_get_process_header(litl_read_process_t *process)
Returns a pointer to the process header.
#define LITL_READ_GET_TIME(read_event)
Returns a time stamp of a given event.
A data structure for reading one event.
litl_read_event_t cur_event
litl_read_thread_t ** threads
litl_process_header_t * header
A general structure of LiTL event type.
union litl_t::@0 parameters
litl_size_t litl_read_get_buffer_size(litl_read_trace_t *trace)
Returns the buffer size.
uint8_t * litl_buffer_t
A data type for storing sets of events.
A data structure for reading process-specific events.
litl_read_event_t * litl_read_next_process_event(litl_read_trace_t *trace, litl_read_process_t *process)
Reads the next event from a trace.
litl_buffer_t header_buffer
litl_buffer_t header_buffer
void litl_read_finalize_trace(litl_read_trace_t *trace)
Closes the trace and frees the allocated memory.
void litl_read_set_buffer_size(litl_read_trace_t *trace, const litl_size_t buf_size)
Sets the buffer size.
litl_thread_pair_t * thread_pair
uint16_t litl_med_size_t
An auxiliary data type for the optimized storage of data.
A data structure for pairs (tid, offset) stored in the trace header.
litl_read_event_t * litl_read_next_event(litl_read_trace_t *trace)
Reads the next event from a trace file.
#define LITL_OFFSET_CODE
Defines the code of an event of type offset.
uint8_t litl_data_t
A data type for the optimized storage of parameters.
litl_read_process_t ** processes
uint32_t litl_size_t
An auxiliary data type for storing data.
litl_read Provides a set of functions for reading events from a regular trace file or an archive of t...
litl_buffer_t header_buffer_ptr
#define LITL_READ_GET_CUR_EVENT(process)
Returns a current event of a given trace.
uint64_t litl_time_t
A data type for storing time stamps.
uint64_t litl_trace_size_t
A data type for storing traces sizes.
litl_med_size_t nb_processes
uint64_t litl_offset_t
A data type for storing offsets.
litl_med_size_t nb_threads
void litl_read_init_processes(litl_read_trace_t *trace)
Initializes the event reading structure.
litl_general_header_t * litl_read_get_trace_header(litl_read_trace_t *trace)
Returns a pointer to the trace header.