|
From: Josef W. <Jos...@gm...> - 2007-11-07 10:29:12
|
On Wednesday 07 November 2007, Shahriyar Amini wrote: > Shahriyar Amini wrote: > > Nicholas Nethercote wrote: > > > >> On Sat, 27 Oct 2007, Shahriyar Amini wrote: > >> > >> > >>> Is it possible to have on demand instrumentation through Valgrind? What > >>> I am looking for is to be able to turn on Valgrind while in middle of a > >>> process, or start the process on Valgrind, but only start instrumenting > >>> on some external input to Valgrind. > >>> > >> You cannot start the program natively and then attach Valgrind. Tools > >> can be written so that they do no instrumentation to begin with (which > >> results in a typical 4--5x slowdown) and then start instrumenting code > >> on some kind of external event. The Callgrind tool allows this, but > >> no others currently do. > >> > >> Nick > >> > > Hi, > > > > How does Callgrind support instrumentation on external input? What is > > this current external input? I am looking at the pre_syscall and > > post_syscall handlers for Callgrind, but did not find anything specific. Hi, there are 3 ways to influence instrumentation mode in Callgrind: * initial mode via command line option --instr-atstart=no|yes * per client request from code, as you found out in the nearby posting * interactively via the callgrind_control -i on/off The last one is a little hack, and not really supported by Valgrind core. It would be nice if there existed core support for asynchronous external events. The current implementation is done via checking a command file once in a while, see CLG_(check_command)() in callgrind/command.c. This function is called every time Valgrind calls the hook CLG_(run_thread)(). Unfortunately, this is not regularly called when the application is idle. The instrumentation mode is switched in CLG_(set_instrument_state)(). The important thing is the call VG_(discard_translations)( (Addr64)0x1000, (ULong) ~0xfffl); which gets rid of all old translations. Note that this is quite time-consuming. Cheers, Josef > > > > Thanks, > > Shahriyar > > > > ------------------------------------------------------------------------- > > This SF.net email is sponsored by: Splunk Inc. > > Still grepping through log files to find problems? Stop. > > Now Search log events and configuration files using AJAX and a browser. > > Download your FREE copy of Splunk now >> http://get.splunk.com/ > > _______________________________________________ > > Valgrind-users mailing list > > Val...@li... > > https://lists.sourceforge.net/lists/listinfo/valgrind-users > > > > I believe I found the answer to my question. The external input is > handled as a client request: > > case VG_USERREQ__START_INSTRUMENTATION: > CLG_(set_instrument_state)("Client Request", True); > *ret = 0; /* meaningless */ > break; > > case VG_USERREQ__STOP_INSTRUMENTATION: > CLG_(set_instrument_state)("Client Request", False); > *ret = 0; /* meaningless */ > break; > > > which then sets the instrumentation state. > > Thanks, > Shahriyar > > > > ------------------------------------------------------------------------- > This SF.net email is sponsored by: Splunk Inc. > Still grepping through log files to find problems? Stop. > Now Search log events and configuration files using AJAX and a browser. > Download your FREE copy of Splunk now >> http://get.splunk.com/ > _______________________________________________ > Valgrind-users mailing list > Val...@li... > https://lists.sourceforge.net/lists/listinfo/valgrind-users > |