Dataset Reader

class ptp.reader.Reader(ds_file=None, infer_secs=False, no_pps=False, reverse_ms=True)[source]

Reader of data acquired through the testbed

Reads a log file containing timestamps acquired via serial communication with the testbed. Post-processes the timestamps following the same sequence that is adopted in PTP simulation and similarly saves reults into a list of dictionaries containing the same keys as produced by the simulation.

check_progress(i_iter, n_iter)[source]

Check/print simulation progress

Parameters
  • i_iter – Iteration index

  • n_iter – Numger of iterations

process(data, pr_level=10)[source]

Process a set of timestamps

Apply the timestamps into a delay request-response mechanism object and use the latter to obtain PTP metrics.

Parameters
  • data – dicitionary containing timestamp data

  • pr_level – logging level to be used when logging timestamps

Returns

results dictionary containing PTP sync metrics

run(max_len=0)[source]

Loads timestamps and post-processes to generate PTP data

Load a list containing sets of timestamps (t1, t2, t3 and t4) from a JSON and save each set of PTP metrics into self.data just like the PTP simulation would.

Parameters

max_len – Maximum number of entries to process

trim(interval)[source]

Restrict dataset to given interval

Parameters

interval – Desired dataset interval given as start:end in hours