Skip to content

milescm/linuxptp

Repository files navigation

Introduction

This files used the Precision Time Protocol(PTP) according to IEEE standard 1588 for Linux.

It contains log files that are generated at a specified time and analyzed and visualized.

Environment

Master OS : Ubuntu20.04LTS

Slave OS : Ubuntu18.04LTS

python version : 3.6

Slave Bash version : 4.4.20

Precondition

The PATH in the code must be modified according to the user's system.

The master computer's ptp4l service must always be running.

How to Use

  1. Run run.sh in the terminal command.
./run.sh

run_1

  • When the ptp4l service ends, Input the file name to convert JSON file to csv

run_2

  • When the file name is entered, check the created txt and JSON files.
  • A csv file is created
  • A txt file is read to output the convergence index and offset
  1. Run findConvergence.py in the terminal command.
./findConvergence.py

findconvergence

  • You need to view the contents of the code and modify the PATH of the txt file

  • This python code analyzes a txt file and outputs the index and offset of the converged section.

  1. Run jsonToCsv.py in the terminal command.
  • This python code converts log files output in JSON format to csv files.
./jsonTocsv.py

jsontocsv

  • You need to view the contents of the code and modify the PATH of the JSON file
  1. Run csv_Visualization.ipynb in the jupyter-notebook
  • This file visualizes the data via csv file.
jupyter-notebook
  • You need to view the contents of the code and modify the PATH of the csv file

File Configuration

run.sh

This shell code runs on the slave.

This program runs the 'ptp4l' service for 5min and stops it.

The log of the service is saved as a txt file and a JSON file through redirection.

(Use journalctl to print the system log as a JSON file.)

The JSON file has TIMESTAMP, but the txt file has no time variable.

findConvergence.py

When the offset is constant below 1000, set to convergence.

This file compares the offset values of the txt file and judges that it is convergence.

jsonToCsv.py

This file converts JSON file to csv.

scatter_Visualization.ipynb

This file visualizes the data.

Result

offset_during5min

0 - 1 min

offset_0_1min

1 - 2 min

offset_1_2min

90 - END

offset_2min_END

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages