[LinuxPPS] Profiling the latency of the testptp program

Rodolfo Giometti giometti at enneenne.com
Thu Sep 7 08:46:35 CEST 2023


On 06/09/23 19:29, First Last wrote:
> Hi there,
> 
> I am trying to profile the latency of the testptp.c self-test in the linux 
> kernel (linux/tools/testing/selftests/ptp/testptp.c). (This will become more 
> clear later on)
> 
> I have compiled it separately, and am using the following commands to enable PPS 
> on my Intel I210 NICs:
> 
> ./testptp -d /dev/ptp0 -L 0,2
> ./testptp -d /dev/ptp0 -p 1000000000
> 
> Using an oscilloscope, I can see the PPS signal being asserted on my NIC at 
> 1PPS, and I can see the "assert" timestamp by using:
> 
> cat /sys/class/pps/pps0/assert
> 
> It's not clear to me what timestamp is showing under the assert file.

You are mixing two different things: PPS and PTP. You should clear your hardware 
settings in order to understand your software functioning and then answering to 
this question.

> I'm 
> assuming that an interrupt is generated after a certain amount of clock ticks 
> assert the PPS signal on the pin. Presumably, there is a latency between when 
> the interrupt is generated, and when the PPS pin is actually asserted. I 
> understand this latency will be very small, but I'd still like to profile it. Is 
> the timestamp in "assert" the time that the IRQ was generated, or the time that 
> the PPS pin was actually asserted?

In LinuxPPS the "assert" time is the time when the function pps_event() is 
called within the IRQ handler related to the PPS pulse.

> I was going to use cyclictest

What is "cyclictest"?

> to profile the latency between the call for PPS to 
> be asserted, and when it's actually asserted, but I don't think I can do that 
> since there isn't a process that actively does this. Any ideas?

You can overestimate using a PPS echo function (like in the client pps-gpio.c) 
to generate an output pulse and then measure the delay with an oscilloscope.

Ciao,

Rodolfo

-- 
GNU/Linux Solutions                  e-mail: giometti at enneenne.com
Linux Device Driver                          giometti at linux.it
Embedded Systems                     phone:  +39 349 2432127
UNIX programming                     skype:  rodolfo.giometti




More information about the discussions mailing list