reactor-c
C Runtime for Lingua Franca
Loading...
Searching...
No Matches
trace_to_csv.c File Reference
#include <stdio.h>
#include <string.h>
#include "reactor.h"
#include "trace.h"
#include "trace_util.h"
#include "trace_impl.h"

Data Structures

struct  reaction_stats_t
 
struct  summary_stats_t
 

Macros

#define LF_TRACE
 
#define MAX_NUM_REACTIONS   64
 
#define MAX_NUM_WORKERS   64
 

Typedefs

typedef struct reaction_stats_t reaction_stats_t
 
typedef struct summary_stats_t summary_stats_t
 

Functions

void usage ()
 
size_t read_and_write_trace (instant_t trace_start_time, instant_t trace_end_time)
 
void write_summary_file ()
 
instant_t string_to_instant (const char *time_spec, const char *units)
 
int process_args (int argc, const char *argv[], char **root, instant_t *start_time, instant_t *end_time)
 
int main (int argc, const char *argv[])
 

Variables

FILE * trace_file = NULL
 
FILE * output_file = NULL
 
FILE * summary_file = NULL
 
int table_size
 
summary_stats_t ** summary_stats
 
instant_t latest_time = 0LL
 

Detailed Description

Author
Edward A. Lee

LICENSE

Copyright (c) 2020, The University of California at Berkeley

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

  1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
  2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

DESCRIPTION

Standalone program to convert a Lingua Franca trace file to a comma-separated values text file.

Macro Definition Documentation

◆ LF_TRACE

#define LF_TRACE

◆ MAX_NUM_REACTIONS

#define MAX_NUM_REACTIONS   64

◆ MAX_NUM_WORKERS

#define MAX_NUM_WORKERS   64

Typedef Documentation

◆ reaction_stats_t

typedef struct reaction_stats_t reaction_stats_t

Struct for collecting summary statistics for reaction invocations.

◆ summary_stats_t

typedef struct summary_stats_t summary_stats_t

Struct for collecting summary statistics.

Function Documentation

◆ main()

int main ( int argc,
const char * argv[] )

◆ process_args()

int process_args ( int argc,
const char * argv[],
char ** root,
instant_t * start_time,
instant_t * end_time )

◆ read_and_write_trace()

size_t read_and_write_trace ( instant_t trace_start_time,
instant_t trace_end_time )

Read a trace in the trace_file and write it to the output_file as CSV.

Returns
The number of records read or 0 upon seeing an EOF.

◆ string_to_instant()

instant_t string_to_instant ( const char * time_spec,
const char * units )

◆ usage()

void usage ( )

Print a usage message.

◆ write_summary_file()

void write_summary_file ( )

Write the summary file.

Variable Documentation

◆ latest_time

instant_t latest_time = 0LL

Largest timestamp seen.

◆ output_file

FILE* output_file = NULL

File for writing the output data.

◆ summary_file

FILE* summary_file = NULL

File for writing summary statistics.

◆ summary_stats

summary_stats_t** summary_stats

Summary stats array. This array has the same size as the object table. Pointer in the array will be void if there are no stats for the object table item.

◆ table_size

int table_size

Size of the stats table is object_table_size plus twice MAX_NUM_WORKERS.

◆ trace_file

FILE* trace_file = NULL

File containing the trace binary data.