Files
RiedelScripts/PTPLogger/README.md
T
2026-06-15 09:56:48 +10:00

173 lines
2.8 KiB
Markdown

# PTP Monitoring Toolkit
## Overview
This toolkit provides two main components:
- PTP log collector (bash script)
- PTP graphing tool (Python GUI)
These tools allow you to collect PTP statistics from ptp4l and visualise timing behaviour, including RMS offset, frequency deviation, state changes, and master changes.
---
## 1. PTP Log Collector
### Purpose
The log collector records PTP statistics at approximately 1 Hz and formats them similarly to ptp4l output.
### Example Output
```
Jun 12 16:49:58 host ptp4l@media1: [6443.95] rms 62 max 191 freq -307 +/- 86 delay 1121 +/- 13
```
### Running the Collector
Ensure ptp4l is running and accessible via a UNIX socket.
Run the script:
```
bash PTPLogger.sh
```
### Requirements
- linuxptp installed
- pmc available
- Access to correct ptp4l socket (e.g. /var/run/ptp4l_media1)
### Common Issues
- All values are zero: ptp4l is not synced or no master is present
- No output: incorrect socket or domain
---
## 2. PTP Graphing Tool
### Purpose
The Python GUI tool visualises collected logs and detects PTP events.
### Features
- Plots RMS offset and frequency deviation
- Displays PTP state changes
- Displays master clock changes
- Adjustable time resolution
- Handles multi-day logs
### How to Run
```
python PTPLogger_Graphing.py
```
### Usage
1. Click "Open Log"
2. Select a log file
3. Choose time detail if required
4. View graphs and event list
### Supported Log Format
The tool requires log lines containing:
```
rms <value> ... freq <value>
```
### Graph Interpretation
- RMS: timing accuracy
- Frequency deviation: servo behaviour
- Blue vertical lines: state changes
- Red vertical lines: master changes
---
## 3. Dependencies
### Python Requirements
- Python 3.8 or newer
### Install Dependencies
On both Windows and Linux:
```
python -m pip install matplotlib
```
Tkinter is included with most Python installations.
---
## 4. Compilation (Windows)
### Install PyInstaller
```
python -m pip install pyinstaller
```
### Build Executable
```
pyinstaller --onefile --windowed PTPLogger_Graphing.py
```
### Output
```
dist/PTPLogger_Graphing.exe
```
---
## 5. Compilation (Linux)
### Install Dependencies
```
sudo apt install python3 python3-pip python3-tk
pip3 install matplotlib pyinstaller
```
### Build Executable
```
pyinstaller --onefile --windowed PTPLogger_Graphing.py
```
### Output
```
dist/PTPLogger_Graphing
```
Run:
```
./dist/PTPLogger_Graphing
```
---
## 6. Notes
- The graphing tool works best with continuous ptp4l statistics output
- If logs contain no RMS data, the graph will be empty
- Correct socket configuration is required for pmc to collect data
---
## Summary
The log collector gathers PTP timing data, and the graphing tool provides visual analysis for troubleshooting and performance monitoring.