Runtime discrepancy clock_gettime + funcition instrumentation

Christian Weiss Christian.Weiss@EMEA.NEC.COM
Thu Jul 29 08:18:31 GMT 2021


Dear Florian,

Thank you for the quick reply. As far as I understand, I can check if vdso is used by using strace on the binary. Doing so I get:

```[cweiss@amd022 overhead]$ strace ./test_time_static_gcc.x 1 2>&1 | grep -i clock_gettime
clock_gettime(CLOCK_MONOTONIC, {tv_sec=89045, tv_nsec=95268751}) = 0
clock_gettime(CLOCK_MONOTONIC, {tv_sec=89145, tv_nsec=95813405}) = 0
clock_gettime(CLOCK_MONOTONIC, {tv_sec=89145, tv_nsec=95863144}) = 0
clock_gettime(CLOCK_MONOTONIC, {tv_sec=89145, tv_nsec=95933573}) = 0
[cweiss@amd022 overhead]$ strace ./test_time_dyn_gcc.x 1 2>&1 | grep -i clock_gettime```

Am I right that this implies that vdso is not used in the static binary, but in the dynamic one? Is there a way to activate it in the static case or do I just have to live with that?

Best regards,
Christian

-----Original Message-----
From: Florian Weimer [mailto:fweimer@redhat.com] 
Sent: 29 July 2021 09:32
To: Christian Weiss <Christian.Weiss@EMEA.NEC.COM>
Cc: libc-help@sourceware.org; Felix Uhl <Felix.Uhl@EMEA.NEC.COM>
Subject: Re: Runtime discrepancy clock_gettime + funcition instrumentation

* Christian Weiss:

> Measuring the runtime, the static binary takes about five times more time to finish than the dynamic one. I do not yet understand this observation:
>
> [cweiss@amd022 overhead]$ time ./test_time_static_gcc.x 10000000
> sum: 49999995000000
> real         0m2.594s
> user        0m0.396s
> sys           0m2.197s
> [cweiss@amd022 overhead]$ time ./test_time_dyn_gcc.x 10000000
> sum: 49999995000000
>
> real         0m0.518s
> user        0m0.515s
> sys           0m0.002s

Have you checked that the statically linked version uses vDSO acceleration instead of system calls?

Thanks,
Florian



 Click https://www.mailcontrol.com/sr/fIQaiVcf9cfGX2PQPOmvUg0Q1FXI7Aabn0rrnrkHFzjvcdFTukB4r3gIRLMubDcYTms2r1hgqRkeq4Nrivo6iw==  to report this email as spam.


More information about the Libc-help mailing list