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

Macros

#define LF_TRACE
 
#define __STDC_WANT_LIB_EXT2   1
 
#define PID_FOR_USER_EVENT   1000000
 
#define PID_FOR_WORKER_WAIT   0
 
#define PID_FOR_WORKER_ADVANCING_TIME   0
 
#define PID_FOR_UNKNOWN_EVENT   2000000
 

Functions

void usage ()
 
size_t read_and_write_trace ()
 
void write_metadata_events (FILE *output_file)
 
int main (int argc, char *argv[])
 

Variables

int max_thread_id = 0
 
FILE * trace_file = NULL
 
FILE * output_file = NULL
 
int max_reaction_number = 0
 
bool physical_time_only = false
 

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 JSON file suitable for viewing in Chrome's event visualizer. To visualize the resulting file, point your chrome browser to chrome://tracing/ and the load the .json file.

Macro Definition Documentation

◆ __STDC_WANT_LIB_EXT2

#define __STDC_WANT_LIB_EXT2   1

◆ LF_TRACE

#define LF_TRACE

◆ PID_FOR_UNKNOWN_EVENT

#define PID_FOR_UNKNOWN_EVENT   2000000

◆ PID_FOR_USER_EVENT

#define PID_FOR_USER_EVENT   1000000

◆ PID_FOR_WORKER_ADVANCING_TIME

#define PID_FOR_WORKER_ADVANCING_TIME   0

◆ PID_FOR_WORKER_WAIT

#define PID_FOR_WORKER_WAIT   0

Function Documentation

◆ main()

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

◆ read_and_write_trace()

size_t read_and_write_trace ( )

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

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

◆ usage()

void usage ( )

Print a usage message.

◆ write_metadata_events()

void write_metadata_events ( FILE * output_file)

Write metadata events, which provide names in the renderer.

Parameters
output_fileAn open output .json file.

Variable Documentation

◆ max_reaction_number

int max_reaction_number = 0

Maximum reaction number encountered.

◆ max_thread_id

int max_thread_id = 0

Maximum thread ID seen.

◆ output_file

FILE* output_file = NULL

File for writing the output data.

◆ physical_time_only

bool physical_time_only = false

Indicator to plot vs. physical time only.

◆ trace_file

FILE* trace_file = NULL

File containing the trace binary data.