On Sat, Sep 16, 2017 at 04:51:00AM +0800, Sen Han wrote:
> Thanks for your information. I want to use `ltrace` to find out if the
> golang binary is using
> the __vdso_clock_gettime_sym with CLOCK_MONOTONIC option for measuring time
> interval.
> 
> But it finally turns out currently the `ltrace` cannot works very well with
> go built binaries on
> vdso tracing.
> 
> Is there some exist tools could trace the vdso call in golang? Or is there
> any recommend methods
> could achieve it on the runtime?

Go is free software so instead of trying to trace the binaries its
compiler creates, you could just grep the runtime's source code. ;-)
Especially given the fact that since version 1.5 Go is entirely written
in Go (modulo some assembly code).

I have just grepped the checkout of 1.9 for CLOCK_MONOTONIC, and
I think devel/golang1.9/src/runtime/sys_linux_amd64.s is what you need.
Look for the "nanotime" function.

Note that at least on i386 and amd64, Linux maps the memory ranges
containing the data related to date/time information into the address
space of every process, so reading these data does not involves any
syscalls -- merely direct reads of the data located at a certain memory
address.

IIRC, on Windows, a similar mechanism is used.  Don't know about other
supported kernels.

-- 
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.
For more options, visit https://groups.google.com/d/optout.

Reply via email to