[NSWI131] HW 7: clock_gettime

Petr Tůma petr.tuma at d3s.mff.cuni.cz
Fri Apr 24 16:35:38 CEST 2020


Hi,

you could try to use the IARG_TSC argument to the instrumentation routine, that should give you the TSC register value.

In general, it's recommended to use PinCRT library function in the tool rather than calling the OS, there is also OS_Time that should give you microseconds (https://software.intel.com/sites/landingpage/pintool/docs/97619/PinCRT/html/group__OS__APIS__TIME.html).

The way I understand things, it is quite difficult to have two working but otherwise independent instances of the same libc in memory, which is why Pin uses its own libc replacement, which does not implement all functions of the standard libc.

Hope this helps, Petr


On 24/04/2020 16:01, Karel Maděra wrote:
> Hello,
> 
> I know it is after deadline for HW7, but I just can't get it to work and I would like to finish it anyway.
> 
> How do you measure time in your pintool?
> 
> I tried to use clock_gettime, which is declared in the PIN headers, so it compiles just fine, but when I run
> pin with the tool it crashes when dynamic loader cannot find implementation in the PIN CRT.
> 
> It writes the following error:
> Unable to load home/07-pin-maderak/obj-intel64/write_throughput.so: dlopen failed: cannot locate symbol "clock_gettime" referenced by "home/07-pin-maderak/obj-intel64/write_throughput.so"...
> 
> I used the makefile from the PIN simple examples and I checked that it is linking and loading the correct libraries.
> 
> The I looked at the exported symbols of the PIN CRT libraries and could not find any mention of clock_gettime,
> so is it just me and the version of PIN I downloaded or is it really not implemented?
> 
> Clock_gettime seemed like the right choice for the measurement we are trying to do, so I just tried to make
> it work with no success.
> Should I use something like rdtscp or gettimeofday ?
> 
> Karel Madera
> 
> _______________________________________________
> NSWI131 mailing list
> NSWI131 at d3s.mff.cuni.cz
> https://d3s.mff.cuni.cz/mailman/listinfo/nswi131
> 


More information about the NSWI131 mailing list