Tools for PTP (and NTP)
This directory contains scripts and libraries for interpreting log files from both PTP and NTP. The scripts and libraries are mainly written in R https://www.r-project.org, which handles comma separated value (CSV) files quite well and is far better at graphing than other choices.
If you do not want to rebuild the documentation, which we already ship, then you only need to use R to install the packages in the following way:
prompt> R CMD INSTALL ptplib
prompt> R CMD INSTALL ntplib
You may need to have root or sudo like powers to install the package.
The individual library routines are documented in their respective manual pages (see ptplib/man and ntplib/man directories).
prompt> stats.R ptp.stats.file [output]
Open a pre-existing PTPd statistics file and output various stats about the data contained therein.
Measurements: 175229 Offset min: -1.2248e-05 max: 5.7004e-05 median: -1.99e-06 mean: -1.220213e-06 std dev: 4.617933e-06 variance: 2.132531e-11 Delay min: 1.5461e-05 max: 1.9573e-05 median: 1.6904e-05 mean: 1.690247e-05 std dev: 4.441999e-07 variance: 1.973135e-13 Master -> Slave min: 2e-06 max: 0.000127 median: 1.5e-05 mean: 1.569502e-05 std dev: 6.037791e-06 variance: 3.645492e-11 Slave -> Master min: 3e-06 max: 7.3e-05 median: 1.8e-05 mean: 1.807442e-05 std dev: 3.502559e-06 variance: 1.226792e-11 ``` The number of measurements found in the file is followed by various statistics measured in seconds. The slave's offset from the master, the measured network delay, and the network delay in both directions are displayed. Also generate a full graph of all the points in the file for each measurement class. The output file name can be specified on the command line, otherwise the script uses the basename of the data file to generate one for you. ```prompt> offset.R ptp.stats.file [output]``` ``` Data file: test-ptpstats Measurements: 162970 Offset min: -1.6824e-05 max: 4.1732e-05 median: 2.918e-06 mean: 3.192941e-06 std dev: 6.529671e-06 variance: 4.26366e-11 Outside Boundary: 0 Percentage: 0 ``` For the data file mentioned show only the offset statistics. Also generate a PNG of the full graph of all the points in the file. The output file name can be specified on the command line, otherwise the script uses the basename of the data file to generate one for you. `prompt> ntpoffset.R loopstats [output]` Generate a graph of NTP offset from a loopstats file generated by ntpd. The output file name can be specified on the command line, otherwise the script uses the basename of the data file to generate one for you