Skip to content

Commit

Permalink
Merge pull request #259 from lf-lang/move-tracing-utils
Browse files Browse the repository at this point in the history
Move tracing utils
  • Loading branch information
lhstrh authored Aug 18, 2023
2 parents 809c454 + 4b9340e commit 582608d
Show file tree
Hide file tree
Showing 15 changed files with 2,856 additions and 0 deletions.
19 changes: 19 additions & 0 deletions .github/workflows/build-trace-tools.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
name: Build the tracing tools

on:
workflow_call:

jobs:
run:
strategy:
matrix:
platform: [ubuntu-latest, macos-latest, windows-latest]
runs-on: ${{ matrix.platform }}

steps:
- name: Check out reactor-c repository
uses: actions/checkout@v3
- name: Building tracing utils
working-directory: ./util/tracing
run: make
shell: bash
3 changes: 3 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,9 @@ jobs:
build-rti:
uses: lf-lang/reactor-c/.github/workflows/build-rti.yml@main

build-trace-tools:
uses: lf-lang/reactor-c/.github/workflows/build-trace-tools.yml@move-tracing-utils

fetch-lf:
uses: lf-lang/lingua-franca/.github/workflows/extract-ref.yml@master
with:
Expand Down
37 changes: 37 additions & 0 deletions util/tracing/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
# Makefile for utilities that convert Lingua Franca trace files
# into other formats.
# @author: Edward A. Lee
REACTOR_C=../../
CC=gcc
CFLAGS= -I$(REACTOR_C)/include/core/ \
-I$(REACTOR_C)/include/core/modal_models \
-I$(REACTOR_C)/include/core/platform \
-I$(REACTOR_C)/include/core/utils \
-DLF_UNTHREADED=1 \
-Wall
DEPS=
LIBS=-lcurl

INSTALL_PREFIX ?= /usr/local/bin

%.o: %.c $(DEPS)
$(CC) -c -o $@ $< $(CFLAGS)

trace_to_csv: trace_to_csv.o trace_util.o
$(CC) -o trace_to_csv trace_to_csv.o trace_util.o

trace_to_chrome: trace_to_chrome.o trace_util.o
$(CC) -o trace_to_chrome trace_to_chrome.o trace_util.o

trace_to_influxdb: trace_to_influxdb.o trace_util.o
$(CC) -o trace_to_influxdb trace_to_influxdb.o trace_util.o $(LIBS)

install: trace_to_csv trace_to_chrome trace_to_influxdb
mv trace_to_csv $(INSTALL_PREFIX)
mv trace_to_chrome $(INSTALL_PREFIX)
mv trace_to_influxdb $(INSTALL_PREFIX)
ln -f -s launch-fedsd.sh $(INSTALL_PREFIX)/fedsd
chmod +x launch-fedsd.sh

clean:
rm -f *.o
30 changes: 30 additions & 0 deletions util/tracing/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
## util/tracing

This directory contains the source code for utilities that are standalone executables
for post-processing tracing data created by the tracing function in Lingua Franca.

Utilities for visualizing the data are contained in the [visualization](visualization/README.md)
directory.

* trace\_to\_csv: Creates a comma-separated values text file from a binary trace file.
The resulting file is suitable for analyzing in spreadsheet programs such as Excel.

* trace\_to\_chrome: Creates a JSON file suitable for importing into Chrome's trace
visualizer. Point Chrome to chrome://tracing/ and load the resulting file.

* trace\_to\_influxdb: A preliminary implementation that takes a binary trace file
and uploads its data into [InfluxDB](https://en.wikipedia.org/wiki/InfluxDB).

* fedsd: A utility that converts trace files from a federate into sequence diagrams
showing the interactions between federates and the RTI.

## Installing

```
sudo make install
```
Will install the tracing executables to `/usr/local/bin` to install them to a different location, use the `INSTALL_PREFIX` flag, e.g.

```
make install INSTALL_PREFIX=~/.local/bin
```
Loading

0 comments on commit 582608d

Please sign in to comment.