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!");
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]);
285 perror(
"Could not read the next part of the trace file!");
299 for (thread_index = 0; thread_index < process->
nb_threads; thread_index++)
323 event = (
litl_t *) buffer;
341 if (remaining_size < event_size)
347 __litl_read_next_buffer(trace, process, thread);
349 event = (
litl_t *) buffer;
367 __litl_read_next_buffer(trace, process, thread);
369 event = (
litl_t *) buffer;
374 thread->
buffer += evt_size;
375 thread->
offset += evt_size;
386 return __litl_read_next_thread_event(trace, process, thread);
400 for (thread_index = 0; thread_index < process->
nb_threads; thread_index++)
401 __litl_read_next_thread_event(trace, process, process->
threads[thread_index]);
409 __litl_read_next_thread_event(trace, process, process->
threads[process->
cur_index]);
412 for (thread_index = 0; thread_index < process->
nb_threads; thread_index++) {
436 for (process_index = 0; process_index < trace->
nb_processes;
459 for (process_index = 0; process_index < trace->
nb_processes;
462 for (thread_index = 0;
litl_process_header_t * litl_read_get_process_header(litl_read_process_t *process)
Returns a pointer to the process header.
litl_size_t litl_read_get_buffer_size(litl_read_trace_t *trace)
Returns the buffer size.
void litl_read_set_buffer_size(litl_read_trace_t *trace, const litl_size_t buf_size)
Sets the buffer size.
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.
litl_general_header_t * litl_read_get_trace_header(litl_read_trace_t *trace)
Returns a pointer to the trace header.
void litl_read_init_processes(litl_read_trace_t *trace)
Initializes the event reading structure.
void litl_read_reset_process(litl_read_process_t *process)
Resets the trace pointer.
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_read_event_t * litl_read_next_thread_event(litl_read_trace_t *trace, litl_read_process_t *process, litl_read_thread_t *thread)
Reads the next event from a trace.
void litl_read_finalize_trace(litl_read_trace_t *trace)
Closes the trace and frees the allocated memory.
litl_read_event_t * litl_read_next_event(litl_read_trace_t *trace)
Reads the next event from a trace file.
#define LITL_READ_GET_TIME(read_event)
Returns a time stamp of a given event.
#define LITL_READ_GET_CUR_EVENT(process)
Returns a current event of a given trace.
#define LITL_READ_GET_CUR_EVENT_PER_THREAD(process, thread_index)
Returns a current event of a given thread.
#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.
uint32_t litl_size_t
An auxiliary data type for storing data.
uint8_t * litl_buffer_t
A data type for storing sets of events.
#define LITL_MAX_PARAMS
Defines the maximum number of parameters.
uint16_t litl_med_size_t
An auxiliary data type for the optimized storage of data.
#define NBTHREADS
Defines the maximum number of threads (pairs of tid and offset) stored in one data slot.
uint64_t litl_trace_size_t
A data type for storing traces sizes.
uint64_t litl_time_t
A data type for storing time stamps.
uint64_t litl_offset_t
A data type for storing offsets.
litl_read Provides a set of functions for reading events from a regular trace file or an archive of t...
A data structure for reading one event.
A data structure for reading process-specific events.
litl_med_size_t nb_threads
litl_read_thread_t ** threads
litl_buffer_t header_buffer_ptr
litl_buffer_t header_buffer
litl_process_header_t * header
A data structure for reading thread-specific events.
litl_thread_pair_t * thread_pair
litl_read_event_t cur_event
A data structure for reading events from both regular trace files and archives of traces.
litl_general_header_t * header
litl_buffer_t header_buffer
litl_read_process_t ** processes
litl_buffer_t header_buffer_ptr
litl_med_size_t nb_processes
A general structure of LiTL event type.
union litl_t::@0 parameters
A data structure for pairs (tid, offset) stored in the trace header.