I'm not sure if calling through the VDSO is the best solution to this
specific issue, though it does sound like a case that would certainly
benefit.

Regardless, one fairly clean way we could support this would be to make
x/sys/unix.ClockGettime (and Gettimeofday) call through the VDSO rather
than performing the syscall. That is always a valid operation (the VDSO
will make the syscall if it doesn't support the specific options passed),
and I think would solve this problem without even changing the API. It
seems we don't do that already for simplicity of implementation and prior
lack of need.

On Tue, Apr 27, 2021 at 12:13 PM Ian Lance Taylor <i...@golang.org> wrote:

> On Tue, Apr 27, 2021, 8:55 AM Manlio Perillo <manlio.peri...@gmail.com>
> wrote:
>
>> Il giorno martedì 27 aprile 2021 alle 17:51:46 UTC+2 Ian Lance Taylor ha
>> scritto:
>>
>>> On Tue, Apr 27, 2021 at 7:43 AM Manlio Perillo <manlio....@gmail.com>
>>> wrote:
>>> >
>>> > Il giorno lunedì 26 aprile 2021 alle 10:24:09 UTC+2 Pure White ha
>>> scritto:
>>> >>
>>> >> So I really want to know what is the right way to do vdso call
>>> outside runtime?
>>> >>
>>> > What about using a different function instead of time.Now, and using
>>> RawSyscall?
>>>
>>> That wouldn't be a VDSO call. VDSO calls are in general faster than
>>> system calls. There is more background at
>>> https://man7.org/linux/man-pages/man7/vdso.7.html.
>>
>> Ian
>>
>>
>> Yes, that wouldn't a VDSO call.  But since a VDSO call will require cgo ,
>> maybe RawSyscall will be more efficient?
>>
>
> The meaningful comparison is to time.Now, which uses VDSO.  I suppose it
> is possible that RawSyscall of clock_gettime with a coarse clock would be
> faster than time.Now, but I would be surprised.
>
> Ian
>
>> --
> You received this message because you are subscribed to the Google Groups
> "golang-nuts" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to golang-nuts+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/golang-nuts/CAOyqgcX9mfSFq5gucrTCi0PJyVdLzA2xGXNByDeOGOyaFLo1hA%40mail.gmail.com
> <https://groups.google.com/d/msgid/golang-nuts/CAOyqgcX9mfSFq5gucrTCi0PJyVdLzA2xGXNByDeOGOyaFLo1hA%40mail.gmail.com?utm_medium=email&utm_source=footer>
> .
>

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/CALoThU-sH_HvNbZz-NSR-OOa3tZNybw2YNYK43YqWsYkmT-XsA%40mail.gmail.com.

Reply via email to