20 static void __litl_split_open_archive(
const char *arch_name) {
24 if ((__arch->
f_handle = open(arch_name, O_RDONLY)) < 0) {
25 fprintf(stderr,
"Cannot open %s\n", arch_name);
37 static void __litl_split_read_header() {
38 int res __attribute__ ((__unused__));
44 header_size = general_header_size;
55 "The given trace is not an archive. Therefore, there is nothing to split.\n");
67 header_size - general_header_size);
69 perror(
"Could not read the archive header!");
83 static void __litl_split_extract_traces(
const char *dir) {
84 int trace_out, res __attribute__ ((__unused__));
97 res = asprintf(&trace_name,
"%s/%s", dir,
101 if ((trace_out = open(trace_name, O_WRONLY | O_CREAT, 0644)) < 0) {
102 fprintf(stderr,
"Cannot create and open %s\n",
108 res = write(trace_out, __arch->
trace_header, general_header_size);
113 res = write(trace_out, __arch->
process_header, process_header_size);
116 lseek(__arch->
f_handle, buffer_size, SEEK_SET);
126 res = write(trace_out, __arch->
buffer, buffer_size);
139 static void __litl_split_close_archive() {
151 __litl_split_open_archive(arch_name);
154 __litl_split_read_header();
157 __litl_split_extract_traces(output_dir);
160 __litl_split_close_archive();
litl_buffer_t header_buffer_ptr
void litl_split_archive(const char *arch_name, const char *output_dir)
Extracts each trace from an archive into a separate trace file.
litl_split Provides a set of functions for extracting trace files from an archive of traces ...
A data structure for splitting an archive of traces.
litl_med_size_t nb_processes
litl_buffer_t header_buffer
uint8_t * litl_buffer_t
A data type for storing sets of events.
litl_process_header_t * process_header
litl_general_header_t * trace_header
uint16_t litl_med_size_t
An auxiliary data type for the optimized storage of data.
uint32_t litl_size_t
An auxiliary data type for storing data.