Open rupran opened 2 weeks ago
@rupran Thank you for your feedback. We appreciate your comments and will definitely take them into consideration. We will work on finding a more efficient way to check liveness of ptp4l. Will share to you the solution asap.
Hi @rupran, thanks for reporting the issue. I am trying to reproduce it, however I get around 2% cpu usage, as shown in snapshot below. This value is still around the same even the contents of is_ptp4l_running is replacing with return true. I am using ADL-N board with Ubuntu 22.04.
Do you mind to share your environment and the way you check the cpu usage?
Our environment is based on Debian 12 with PREEMPT_RT and running on an Intel Xeon W-1115MLE CPU.
While the values under CPU% in top
and htop
show a low number, pinning the proxy to core 3 by modifying the run_proxy.sh
script like the following:
--- a/jclklib/proxy/run_proxy.sh
+++ b/jclklib/proxy/run_proxy.sh
@@ -11,4 +11,4 @@
SCRIPT_PATH="$(dirname "$0")"
TEST_PATH="${SCRIPT_PATH}/../.."
-LD_LIBRARY_PATH=$TEST_PATH $SCRIPT_PATH/jclklib_proxy
+LD_LIBRARY_PATH=$TEST_PATH taskset 0x8 $SCRIPT_PATH/jclklib_proxy
shows that the core is running at higher load:
Running perf top -C 3
shows that the time is spent in libc and the kernel, most likely in preparation for spawning the new process (further down the stack, ld-linux-x86-64.so
also takes up cycles in symbol resolution during loading).
Our environment is based on Debian 12 with PREEMPT_RT and running on an Intel Xeon W-1115MLE CPU.
While the values under CPU% in
top
andhtop
show a low number, pinning the proxy to core 3 by modifying therun_proxy.sh
script like the following:--- a/jclklib/proxy/run_proxy.sh +++ b/jclklib/proxy/run_proxy.sh @@ -11,4 +11,4 @@ SCRIPT_PATH="$(dirname "$0")" TEST_PATH="${SCRIPT_PATH}/../.." -LD_LIBRARY_PATH=$TEST_PATH $SCRIPT_PATH/jclklib_proxy +LD_LIBRARY_PATH=$TEST_PATH taskset 0x8 $SCRIPT_PATH/jclklib_proxy
shows that the core is running at higher load:
Running
perf top -C 3
shows that the time is spent in libc and the kernel, most likely in preparation for spawning the new process (further down the stack,ld-linux-x86-64.so
also takes up cycles in symbol resolution during loading).
thank for the detail. We will try on our machine.
Commit 268de83c2e86 ("jclklib: Fix proxy not able to reconnect to ptp4l") implemented a reconnect possibility for the proxy in case
ptp4l
was stopped and restarted. However, this introduces a call topopen
in the main event loop insideptp4l_event_loop
.This can lead to unpredictable delays and a lot of overhead[1] in the proxy, and should be handled much more efficiently.
[1]: On my system, the
jclklib_proxy
process uses ~20 percent with a logSyncInterval of 0 (1 second interval between messages) in theptp4l
configuration file and ~65 percent with a logSyncInterval of -5 (31.25ms message interval) of a core on the currentmain
branch (that is, with thepopen
call in place).Replacing the contents of
is_ptp4l_running
withreturn true;
reduces this load to a negligible number.