|
From: Mike L. <mik...@gm...> - 2015-02-01 21:06:37
|
Hi! I'm writing a logger for a profiler that attaches to Callgrind, and I wanted to log the time for my error/log messages, along with the message itself. I'm using Valgrind's VG_(message) system, and plan to integrate Valgrind's errormgr at some point, but right now I just want to deal with it myself. I didn't find Valgrind wrappers to deal with system time and wanted to know if there's anything built in to request time? For now, I'm including <time.h> and using the *time(time_t* rawtime)* *strftime(*char*, int, const char*, *localtime(**time_t*)) *methods. Mainly I want to know if there's a built in Valgrind method for this, or if I should just muck around with the Makefiles to include <time.h> manually, since I get include errors with *#include *<time.h> Thanks, Mike |
|
From: Philippe W. <phi...@sk...> - 2015-02-01 21:21:05
|
On Sun, 2015-02-01 at 16:06 -0500, Mike Lui wrote: > Hi! > > I'm writing a logger for a profiler that attaches to Callgrind, and I > wanted to log the time for my error/log messages, along with the > message itself. I'm using Valgrind's VG_(message) system, and plan to > integrate Valgrind's errormgr at some point, but right now I just want > to deal with it myself. > > > I didn't find Valgrind wrappers to deal with system time and wanted to > know if there's anything built in to request time? For now, I'm > including <time.h> and using the > time(time_t* rawtime) > strftime(char*, int, const char*, localtime(*time_t)) methods. > > > Mainly I want to know if there's a built in Valgrind method for this, > or if I should just muck around with the Makefiles to include <time.h> > manually, since I get include errors with > #include <time.h> Valgrind tools cannot make any use of glibc or any other library. So, you cannot use strftime. If you give option --time-stamp=yes, then user messages will contain an elapsed time since Valgrind startup. You will be able to call the __NR_time syscall in valgrind, but there is no function in valgrind that will print the result in a human readable form. Philippe |
|
From: Mike L. <mik...@gm...> - 2015-02-01 21:24:02
|
Ah, I overlooked going through the Valgrind options first. Using --time-stamp=yes along with VG_(message) should be both valid for what I want, and will also abide by general Valgrind conventions. Thank you! Mike On Sun, Feb 1, 2015 at 4:22 PM, Philippe Waroquiers < phi...@sk...> wrote: > On Sun, 2015-02-01 at 16:06 -0500, Mike Lui wrote: > > Hi! > > > > I'm writing a logger for a profiler that attaches to Callgrind, and I > > wanted to log the time for my error/log messages, along with the > > message itself. I'm using Valgrind's VG_(message) system, and plan to > > integrate Valgrind's errormgr at some point, but right now I just want > > to deal with it myself. > > > > > > I didn't find Valgrind wrappers to deal with system time and wanted to > > know if there's anything built in to request time? For now, I'm > > including <time.h> and using the > > time(time_t* rawtime) > > strftime(char*, int, const char*, localtime(*time_t)) methods. > > > > > > Mainly I want to know if there's a built in Valgrind method for this, > > or if I should just muck around with the Makefiles to include <time.h> > > manually, since I get include errors with > > #include <time.h> > > Valgrind tools cannot make any use of glibc or any other library. > So, you cannot use strftime. > > If you give option --time-stamp=yes, then user messages > will contain an elapsed time since Valgrind startup. > > You will be able to call the __NR_time syscall in valgrind, but > there is no function in valgrind that will print the result > in a human readable form. > > > Philippe > > > |