On Wed, Aug 11, 2021 at 05:13:45PM +0200, JP wrote:
> I understand that performance is much better when using CLOCK_REALTIME (as
> opposed to working with a PHC directly) because a PHC generally exists
> behind a bus on external hardware.  Am I correct in assuming this wouldn't
> be an issue with a PHC vclock?

A virtual PHC is nothing more than a Linux kernel
timecounter/cyclecounter structure on top of a physical PHC which the
kernel keeps completely free-running. The timecounter/cyclecounter
structure provides 'virtual' time bases on top of the same physical
counter, i.e. when you adjust the frequency or the absolute time of the
virtual clock, only a software correction factor is modified, which is
applied to all raw clock values read from the physical PHC. So the
clock_gettime() returned by a virtual PHC is a simple "a * x + b"
translation of the clock_gettime() returned by the backing PHC. This is
also what allows you to have many virtual clocks on top of the same
physical one.

So to answer your question: the performance of reading the time from a
vclock is exactly the same as the performance of doing that from the
physical PHC that's backing it. If the access to the physical PHC is
slow, the access to its vclocks is equally so, which makes timerfds and
so on not very friendly.


_______________________________________________
Linuxptp-users mailing list
Linuxptp-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linuxptp-users

Reply via email to