mirror of
https://github.com/nasa/trick.git
synced 2025-04-05 02:09:14 +00:00
Add How-to-Use-trick-jperf guide to How-to's. (#1864)
Some checks failed
Linux Python 2 / build (clang-devel gcc gcc-c++ java-11-openjdk-devel libxml2-devel llvm-devel llvm-static ncurses-devel openmotif openmotif-devel perl perl-Digest-MD5 udunits2 udunits2-devel which zlib-devel python2-devel python3-devel, map[arch:rhel]) (push) Has been cancelled
Linux Python 2 / build (map[], echo package manager already configured, bison clang flex git llvm make maven cmake zip, install -y, echo gtest already installed) (push) Has been cancelled
Linux Python 2 / build (map[arch:debian arch_ver:12 os:ubuntu tag:22.04], 2) (push) Has been cancelled
Linux Python 2 / build (map[arch:rhel arch_ver:7], yum -y install epel-release
yum -y update
, libX11-devel libXt-devel swig3 gtest-devel, yum) (push) Has been cancelled
Linux Python 2 / build (map[arch:rhel arch_ver:8 os:oraclelinux tag:8], 2) (push) Has been cancelled
Linux Python 2 / build (map[arch:rhel arch_ver:8 os:rockylinux tag:8], 2) (push) Has been cancelled
Linux Python 2 / build (map[arch:rhel arch_ver:8], dnf -y install epel-release
dnf -y update
dnf install -y 'dnf-command(config-manager)'
, dnf config-manager --enable powertools
dnf install -y gtest-devel
, dnf, swig diffutils) (push) Has been cancelled
Linux Python 2 / build (map[os:oraclelinux], dnf config-manager --enable ol8_codeready_builder
dnf install -y gtest-devel
) (push) Has been cancelled
Linux Python 2 / build (swig curl g++ libx11-dev libxml2-dev libxt-dev libmotif-common libmotif-dev zlib1g-dev llvm-dev libclang-dev libudunits2-dev libgtest-dev default-jdk python2.7-dev python3-dev python3-pip python3-venv, map[arch:debian], apt-get update, apt-get i… (push) Has been cancelled
32-bit Oracle / trick_32bit_oracle (push) Has been cancelled
Test Docker Hub Images / latest (trick_ubuntu1804) (push) Has been cancelled
More Linux / build (clang-devel gcc gcc-c++ java-11-openjdk-devel libxml2-devel llvm-devel llvm-static ncurses-devel openmotif openmotif-devel perl perl-Digest-MD5 udunits2 udunits2-devel which zlib-devel python2-devel python3-devel, map[arch:rhel]) (push) Has been cancelled
More Linux / build (map[], echo package manager already configured, bison clang flex git llvm make maven cmake zip, install -y, echo gtest already installed) (push) Has been cancelled
More Linux / build (map[arch:debian arch_ver:10 os:debian tag:10], 2) (push) Has been cancelled
More Linux / build (map[arch:debian arch_ver:10 os:debian tag:10], 3) (push) Has been cancelled
More Linux / build (map[arch:debian arch_ver:10], apt-get install -y libgtest-dev
cd /usr/src/gtest
cmake .
make
cp libgtest* /usr/lib/
) (push) Has been cancelled
More Linux / build (map[arch:debian arch_ver:11 os:debian tag:11], 2) (push) Has been cancelled
More Linux / build (map[arch:debian arch_ver:11 os:debian tag:11], 3) (push) Has been cancelled
More Linux / build (map[arch:debian arch_ver:11 os:ubuntu tag:20.04], 2) (push) Has been cancelled
More Linux / build (map[arch:debian arch_ver:11 os:ubuntu tag:20.04], 3) (push) Has been cancelled
More Linux / build (map[arch:debian arch_ver:11], export DEBIAN_FRONTEND=noninteractive
apt-get update
apt-get install -y tzdata
) (push) Has been cancelled
More Linux / build (map[arch:debian arch_ver:12 os:debian tag:bookworm], 2) (push) Has been cancelled
More Linux / build (map[arch:debian arch_ver:12 os:debian tag:bookworm], 3) (push) Has been cancelled
More Linux / build (map[arch:debian], 2, python2.7-dev) (push) Has been cancelled
More Linux / build (map[arch:rhel arch_ver:8 os:almalinux tag:8], 2) (push) Has been cancelled
More Linux / build (map[arch:rhel arch_ver:8 os:almalinux tag:8], 3) (push) Has been cancelled
More Linux / build (map[arch:rhel arch_ver:8], dnf -y install epel-release
dnf -y update
dnf install -y 'dnf-command(config-manager)'
, dnf config-manager --enable powertools
dnf install -y gtest-devel
, dnf, swig diffutils) (push) Has been cancelled
More Linux / build (swig curl g++ libx11-dev libxml2-dev libxt-dev libmotif-common libmotif-dev zlib1g-dev llvm-dev libclang-dev libudunits2-dev libgtest-dev default-jdk python3-dev python3-pip python3-venv, map[arch:debian], apt-get update, apt-get install -y libg… (push) Has been cancelled
Some checks failed
Linux Python 2 / build (clang-devel gcc gcc-c++ java-11-openjdk-devel libxml2-devel llvm-devel llvm-static ncurses-devel openmotif openmotif-devel perl perl-Digest-MD5 udunits2 udunits2-devel which zlib-devel python2-devel python3-devel, map[arch:rhel]) (push) Has been cancelled
Linux Python 2 / build (map[], echo package manager already configured, bison clang flex git llvm make maven cmake zip, install -y, echo gtest already installed) (push) Has been cancelled
Linux Python 2 / build (map[arch:debian arch_ver:12 os:ubuntu tag:22.04], 2) (push) Has been cancelled
Linux Python 2 / build (map[arch:rhel arch_ver:7], yum -y install epel-release
yum -y update
, libX11-devel libXt-devel swig3 gtest-devel, yum) (push) Has been cancelled
Linux Python 2 / build (map[arch:rhel arch_ver:8 os:oraclelinux tag:8], 2) (push) Has been cancelled
Linux Python 2 / build (map[arch:rhel arch_ver:8 os:rockylinux tag:8], 2) (push) Has been cancelled
Linux Python 2 / build (map[arch:rhel arch_ver:8], dnf -y install epel-release
dnf -y update
dnf install -y 'dnf-command(config-manager)'
, dnf config-manager --enable powertools
dnf install -y gtest-devel
, dnf, swig diffutils) (push) Has been cancelled
Linux Python 2 / build (map[os:oraclelinux], dnf config-manager --enable ol8_codeready_builder
dnf install -y gtest-devel
) (push) Has been cancelled
Linux Python 2 / build (swig curl g++ libx11-dev libxml2-dev libxt-dev libmotif-common libmotif-dev zlib1g-dev llvm-dev libclang-dev libudunits2-dev libgtest-dev default-jdk python2.7-dev python3-dev python3-pip python3-venv, map[arch:debian], apt-get update, apt-get i… (push) Has been cancelled
32-bit Oracle / trick_32bit_oracle (push) Has been cancelled
Test Docker Hub Images / latest (trick_ubuntu1804) (push) Has been cancelled
More Linux / build (clang-devel gcc gcc-c++ java-11-openjdk-devel libxml2-devel llvm-devel llvm-static ncurses-devel openmotif openmotif-devel perl perl-Digest-MD5 udunits2 udunits2-devel which zlib-devel python2-devel python3-devel, map[arch:rhel]) (push) Has been cancelled
More Linux / build (map[], echo package manager already configured, bison clang flex git llvm make maven cmake zip, install -y, echo gtest already installed) (push) Has been cancelled
More Linux / build (map[arch:debian arch_ver:10 os:debian tag:10], 2) (push) Has been cancelled
More Linux / build (map[arch:debian arch_ver:10 os:debian tag:10], 3) (push) Has been cancelled
More Linux / build (map[arch:debian arch_ver:10], apt-get install -y libgtest-dev
cd /usr/src/gtest
cmake .
make
cp libgtest* /usr/lib/
) (push) Has been cancelled
More Linux / build (map[arch:debian arch_ver:11 os:debian tag:11], 2) (push) Has been cancelled
More Linux / build (map[arch:debian arch_ver:11 os:debian tag:11], 3) (push) Has been cancelled
More Linux / build (map[arch:debian arch_ver:11 os:ubuntu tag:20.04], 2) (push) Has been cancelled
More Linux / build (map[arch:debian arch_ver:11 os:ubuntu tag:20.04], 3) (push) Has been cancelled
More Linux / build (map[arch:debian arch_ver:11], export DEBIAN_FRONTEND=noninteractive
apt-get update
apt-get install -y tzdata
) (push) Has been cancelled
More Linux / build (map[arch:debian arch_ver:12 os:debian tag:bookworm], 2) (push) Has been cancelled
More Linux / build (map[arch:debian arch_ver:12 os:debian tag:bookworm], 3) (push) Has been cancelled
More Linux / build (map[arch:debian], 2, python2.7-dev) (push) Has been cancelled
More Linux / build (map[arch:rhel arch_ver:8 os:almalinux tag:8], 2) (push) Has been cancelled
More Linux / build (map[arch:rhel arch_ver:8 os:almalinux tag:8], 3) (push) Has been cancelled
More Linux / build (map[arch:rhel arch_ver:8], dnf -y install epel-release
dnf -y update
dnf install -y 'dnf-command(config-manager)'
, dnf config-manager --enable powertools
dnf install -y gtest-devel
, dnf, swig diffutils) (push) Has been cancelled
More Linux / build (swig curl g++ libx11-dev libxml2-dev libxt-dev libmotif-common libmotif-dev zlib1g-dev llvm-dev libclang-dev libudunits2-dev libgtest-dev default-jdk python3-dev python3-pip python3-venv, map[arch:debian], apt-get update, apt-get install -y libg… (push) Has been cancelled
This commit is contained in:
parent
aa2e108ea1
commit
957682f68b
@ -12,3 +12,4 @@
|
||||
01. [How to Setup a Virtual Python Environment](How-To-Python-Virtual-Environment)
|
||||
01. [Checkpointing Best Practices](Checkpointing-Best-Practices)
|
||||
01. [Realtime Best Practices](Realtime-Best-Practices)
|
||||
01. [How to Use trick-jperf to visualize a sim's job execution timeline](How-to-Use-trick-jperf)
|
||||
|
204
docs/howto_guides/How-to-Use-trick-jperf.md
Normal file
204
docs/howto_guides/How-to-Use-trick-jperf.md
Normal file
@ -0,0 +1,204 @@
|
||||
# trick-jperf
|
||||
|
||||
**Contents**
|
||||
|
||||
* [Purpose](#purpose)<br>
|
||||
* [Introduction](#introduction)<br>
|
||||
* [Prerequisite Knowledge](#prerequisite-knowledge)<br>
|
||||
* [Recording Simulation Timeline Data](#recording-simulation-timeline-data)<br>
|
||||
* [Running trick-jperf](#running-jperf)<br>
|
||||
* [The trick-jperf GUI](#jperf-gui)<br>
|
||||
|
||||
---
|
||||
|
||||
<a id=purpose></a>
|
||||
## Purpose
|
||||
The purpose of this document is explain how to use **trick-jperf**.
|
||||
|
||||
<a id=introduction></a>
|
||||
## Introduction
|
||||
|
||||
**trick-jperf** is a post-analysis tool that helps one to visualize and analyze the job execution time-line data of a real-time Trick simulation.
|
||||
|
||||
Run interactively, trick-jperf graphically displays the job execution timeline of a realtime Trick simulation. The timeline is displayed as numbered job-frames, each containing (color-coded) jobs within those frames. One can display job statistics for the entire timeline or query the details of individually selected jobs or frames.
|
||||
|
||||
trick-jperf can also be run non-interactively from the command line to generate job-statistics reports.
|
||||
|
||||
---
|
||||
|
||||
<a id=prerequisite-knowledge></a>
|
||||
## Prerequisite Knowledge
|
||||
One should:
|
||||
|
||||
* Complete the [Trick Tutorial](https://nasa.github.io/trick/tutorial/Tutorial), and
|
||||
* Read [Trick Realtime Best Practices](https://nasa.github.io/trick/howto_guides/Realtime-Best-Practices).
|
||||
|
||||
---
|
||||
|
||||
<a id=recording-simulation-timeline-data></a>
|
||||
## Recording Simulation Timeline Data
|
||||
**trick-jperf** requires timeline data from the simulation in question.
|
||||
|
||||
To collect this data, your simulation needs to run in real-time, with frame logging turn on. So, in your Trick sim's input file:
|
||||
|
||||
1. Enable realtime: ```trick.real_time_enable()```
|
||||
|
||||
2. Enable frame-logging: ```trick.frame_log_on()```
|
||||
|
||||
3. We also recommend that you disable itimers: ```trick.itimer_disable()```, or that you simply don't enable them. They are disabled by default. If they enabled when the timeline is collected, your frame boundaries will be ... sloppy.
|
||||
|
||||
--
|
||||
|
||||
<a id=the-timeline-data-file></a>
|
||||
### The Timeline Data File
|
||||
|
||||
When you run your sim in real-time with frame logging enabled, a CSV file named ```log_newtimeline.csv``` will be generated in your sims ```RUN_``` directory. This file contains the timeline data for your sim's main thread.
|
||||
|
||||
#### Example:
|
||||
```
|
||||
jobID,startTime,stopTime
|
||||
12.03, 0.000000, 0.000003
|
||||
12.04, 0.000004, 0.000005
|
||||
17.01, 0.000005, 0.000006
|
||||
...
|
||||
```
|
||||
|
||||
Each record in the time-line file consists of JobID, start-time, and stop-time.
|
||||
The jobID is the same as the jobID's in the ```S_job_execution``` file. The start and stop times are ```real-time```, that is your simulation computer's system time.
|
||||
|
||||
If your simulation has child threads, time-line files will be generated for each of those as well. The first child thread's time-line data file will be named ```log_newtimelineC1.csv```, the second child thread ```log_newtimelineC2.csv``` nad so forth.
|
||||
|
||||
--
|
||||
|
||||
<a id=s_job_execution></a>
|
||||
### ```The S_job_execution``` File
|
||||
|
||||
An ```The S_job_execution```, which is generated when your sim is run is also required by trick-jperf. It details the specifications of jobs running in your sim such as class, phase, ID, and name. This file is also required by trick-jperf.
|
||||
|
||||
---
|
||||
|
||||
<a id=running-jperf></a>
|
||||
## Running trick-jperf
|
||||
|
||||
**trick-jperf** can run interactively with a GUI (the default) or non-interactively (batch). One might run in batch to automate generation of statistics reports, perhaps for continuuous integration.
|
||||
|
||||
### Command-Line Options
|
||||
The following are the options for trick-jperf as displayed when one types ```trick-jperf --help```.
|
||||
|
||||
```
|
||||
usage: trick-jperf [options] <file-name>
|
||||
|
||||
options:
|
||||
-h, --help
|
||||
Print this help text and exit.
|
||||
-x, --nogui
|
||||
Don't run as a GUI application. Command line only.
|
||||
-p, --report
|
||||
Write sorted job statics report to the terminal.
|
||||
-s0, --sort=id
|
||||
Sort job statistics by identifier.
|
||||
-s1, --sort=mean [default]
|
||||
Sort job statistics by mean duration.
|
||||
-s2, --sort=stddev
|
||||
Sort job statistics by standard deviation of duration.
|
||||
-s3, --sort=min
|
||||
Sort job statistics by minimum duration.
|
||||
-s4, --sort=max
|
||||
Sort job statistics by maximum duration.
|
||||
```
|
||||
|
||||
#### Examples
|
||||
|
||||
Report job statistics to the terminal, sorting the output by mean (default) run time.
|
||||
```% trick-jperf -x RUN_test/log_newtimeline.csv```
|
||||
|
||||
Report job statistics to the terminal, sorting the output by Job ID.
|
||||
```% trick-jperf -x -s0 RUN_test/log_newtimeline.csv```
|
||||
|
||||
|
||||
The default mode of JPerf is GUI / interactive mode.
|
||||
|
||||
```% trick-jperf RUN_test/log_newtimeline.csv```
|
||||
|
||||
---
|
||||
|
||||
<a id=jperf-gui></a>
|
||||
## The trick-jperf GUI
|
||||
|
||||
```% trick-jperf RUN_test/log_newtimeline.csv```
|
||||
|
||||

|
||||
|
||||
In its main window **trick-jperf** graphically displays realtime software frames. The frame boundaries, that is **Top of Frame** and **End of Frame**, are where simulation time is synchronized to realtime. The jobs that run within frames are each represented as uniquely colored rectangles. The color assigned to each job is [customizable](#job-colors).
|
||||
|
||||
<a id=XXX></a>
|
||||
### Frames Boundaries
|
||||
Within the job-execution timeline, **trick-jperf** deduces the frame boundaries to be:
|
||||
|
||||
1. A non-top-of-frame job followed by a top-of-frame job, or
|
||||
2. An end-of-frame job followed by a non-end-of-frame job.
|
||||
|
||||
⚠ Take note these, as they can be useful in diagnosing certain kinds of bugs.
|
||||
|
||||
The average period between frame boundaries serves as an estimate of the simulation's intended **Frame Size**. This is initially displayed in the upper toolbar. It is used to scale the frames for rendering. If your sim is well behaved, this estimate will be accurate. If your sim has over-runs, the estimate will likely be off. In this case you can change it by entering your simulations's actual realtime software frame in the **Frame Size** text field.
|
||||
|
||||
The total number of frames in the timeline is displayed in the middle of the upper toolbar. From these, the **Selected Range** specifies the subset of frames to be rendered. Rendering a large number of frames at the one time can slow the responsiveness of the GUI.
|
||||
|
||||
The ▼ and ▲ buttons move the selected range forward and backward by 50.
|
||||
|
||||
<a id=XXX></a>
|
||||
### Selecting Frames & Jobs
|
||||
|
||||
Left clicking on a job displays information about that job in the lower toolbar. In the following picture, we left clicked on a green box in frame 20. Looking at the lower toolbar we see that this "green job" represents the Job whose ID is 16.01, name is ```crewModule.dyn.calc_derivatives```, and job class is ```derivatiave```.
|
||||
|
||||

|
||||
|
||||
On the left side of the display, the frame number is also selected. This is indicated by the red arrow pointing to red the frame number.
|
||||
|
||||
<a id=XXX></a>
|
||||
### Frame Details
|
||||
|
||||
To get the details of the selected frame, we left-click the **Frame Details** button in the upper toolbar. This opens a window (shown below) with the details of frame 20. That is, it displays which and when each of the jobs within that frame were executed.
|
||||
|
||||

|
||||
|
||||
Frame Details can also be displayed using the **View** menu.
|
||||
|
||||

|
||||
|
||||
<a id=job-statistics></a>
|
||||
### Job Statistics
|
||||
|
||||
From the **View** menu, we can also display run-time statistics for simulation jobs.
|
||||
|
||||

|
||||
|
||||
In the toolbar, at the top of the window, are buttons to sort the table by different statistics.
|
||||
|
||||
---
|
||||
|
||||
<a id=job-colors></a>
|
||||
### Job Colors & How They Can Be Customized
|
||||
|
||||
Every Job is represented by a unique Color. Internally these associations are are stored as a Map of ```<JobID, Color>``` pairs, called the KeyedColorMap. Externally they are stored in a text file named ```IdToColors.txt```. Each row contains a job ID followed by RGB values.
|
||||
|
||||
```
|
||||
9.03,149,247,37
|
||||
17.01,24,96,254
|
||||
19.02,247,74,230
|
||||
17.02,138,109,140
|
||||
17.03,219,82,20
|
||||
20.99,171,55,105
|
||||
18.99,228,154,65
|
||||
...
|
||||
```
|
||||
|
||||
When Jperf is run, it looks for a ```IdToColors.txt``` file in the same directory as the timeline file. If it exists, then it's read into the KeyedColorMap.
|
||||
|
||||
Jperf then checks the that every job ID in the timeline file has an associated color in the KeyedColorMap. If it doesn't, then a unique color is generated. The ```<JobID, Color>``` pair are then added to the KeyedColorMap.
|
||||
When timeline processing is complete, the contents of the KeyedColorMap are written to the ```IdToColors.txt``` file.
|
||||
|
||||
Since the ```IdToColors.txt``` file is just a text file, it can be customized to use the colors you prefer.
|
||||
|
||||
--------------------------------------
|
||||
|
BIN
docs/howto_guides/images/jperf/FrameDetails.png
Normal file
BIN
docs/howto_guides/images/jperf/FrameDetails.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 468 KiB |
BIN
docs/howto_guides/images/jperf/JobStats.png
Normal file
BIN
docs/howto_guides/images/jperf/JobStats.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 817 KiB |
BIN
docs/howto_guides/images/jperf/SelectedFrame20.png
Normal file
BIN
docs/howto_guides/images/jperf/SelectedFrame20.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 129 KiB |
BIN
docs/howto_guides/images/jperf/ViewMenu.png
Normal file
BIN
docs/howto_guides/images/jperf/ViewMenu.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 37 KiB |
BIN
docs/howto_guides/images/jperf/trick-jperf.png
Normal file
BIN
docs/howto_guides/images/jperf/trick-jperf.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 132 KiB |
Loading…
x
Reference in New Issue
Block a user