litl  0.1.1
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups
litl_tools.c
Go to the documentation of this file.
1 /* -*- c-file-style: "GNU" -*- */
2 /*
3  * Copyright © Télécom SudParis.
4  * See COPYING in top-level directory.
5  */
6 
7 #include <stdlib.h>
8 #include <inttypes.h>
9 #include <math.h>
10 
11 #include "litl_tools.h"
12 #include "litl_write.h"
13 
14 /*
15  * Returns the size in bytes of a REGULAR event depending on
16  * the number of arguments
17  */
19  return nb_params * sizeof(litl_param_t)
20  + (litl_med_size_t) ceil(LITL_BASE_SIZE / (double) sizeof(litl_param_t))
21  * sizeof(litl_param_t);
22 }
23 
24 /*
25  * Returns the size in bytes of an event of any type
26  */
28  switch (p_evt->type) {
29  case LITL_TYPE_REGULAR:
30  return p_evt->parameters.regular.nb_params * sizeof(litl_param_t)
31  + LITL_BASE_SIZE ;
32  case LITL_TYPE_RAW:
33  return p_evt->parameters.raw.size + LITL_BASE_SIZE + 7;
34  case LITL_TYPE_PACKED:
35  return p_evt->parameters.packed.size + LITL_BASE_SIZE ;
36  default:
37  fprintf(stderr, "Unknown event type %d!\n", p_evt->type);
38  abort();
39  }
40 
41  return 0;
42 }
struct litl_t::@0::@1 regular
litl_med_size_t __litl_get_gen_event_size(litl_t *p_evt)
Returns the size of a general event (in Bytes) depending on its type and the number of its parameters...
Definition: litl_tools.c:27
struct litl_t::@0::@2 raw
#define LITL_BASE_SIZE
Definition: litl_types.h:457
litl_med_size_t __litl_get_reg_event_size(litl_data_t nb_params)
Returns the size of a regular event (in Bytes) depending on the number of its parameters.
Definition: litl_tools.c:18
uint64_t litl_param_t
A data type for the non-optimized storage of parameters.
Definition: litl_types.h:122
A general structure of LiTL event type.
Definition: litl_types.h:190
union litl_t::@0 parameters
uint16_t litl_med_size_t
An auxiliary data type for the optimized storage of data.
Definition: litl_types.h:150
uint8_t litl_data_t
A data type for the optimized storage of parameters.
Definition: litl_types.h:155
struct litl_t::@0::@3 packed
litl_tools Provides a set of auxiliary functions
litl_type_t type
Definition: litl_types.h:193
litl_write Provides a set of functions for recording events in a trace file