|
From: Oriol P. <aut...@gm...> - 2007-08-03 13:16:17
|
Hi, Is it possible to track a fork in a tool code? There is a VG_(track_post_thread_create) where you can register a function callback to be called when a thread is created but is only called in thread creation not in process fork. The purpose is to open a new file descriptor for tracing code in a separated file (one for each process (fork call)). Thanks, Oriol |
|
From: Nicholas N. <nj...@cs...> - 2007-08-04 01:41:30
|
On Fri, 3 Aug 2007, Oriol Prat wrote: > Is it possible to track a fork in a tool code? > > There is a VG_(track_post_thread_create) where you can register a > function callback to be called when a thread is created but is only > called in thread creation not in process fork. > > The purpose is to open a new file descriptor for tracing code in a > separated file (one for each process (fork call)). I think you can do this with the pre_syscall/post_syscall hooks -- just look at the syscall number to work out if the syscall is 'fork'. Nick |
|
From: Oriol P. <aut...@gm...> - 2007-08-06 09:30:36
|
Hi, Thanks Nick. It works fine. But is not a high cost to track entry and exit of all system calls? I'm only interested on clone post_syscall. I guess a function call is expensive for waste twice this time on each system call. Is it possible to track only one system call number? Regards, Oriol 2007/8/4, Nicholas Nethercote <nj...@cs...>: > On Fri, 3 Aug 2007, Oriol Prat wrote: > > > Is it possible to track a fork in a tool code? > > > > There is a VG_(track_post_thread_create) where you can register a > > function callback to be called when a thread is created but is only > > called in thread creation not in process fork. > > > > The purpose is to open a new file descriptor for tracing code in a > > separated file (one for each process (fork call)). > > I think you can do this with the pre_syscall/post_syscall hooks -- just look > at the syscall number to work out if the syscall is 'fork'. > > Nick > |
|
From: Nicholas N. <nj...@cs...> - 2007-08-06 10:19:48
|
On Mon, 6 Aug 2007, Oriol Prat wrote: > Thanks Nick. > It works fine. > > But is not a high cost to track entry and exit of all system calls? My guess is that it wouldn't make much difference because system calls should be relatively rare events, but I could be wrong. It depends on the circumstance. Try doing some timings with and without entry/exit tracking. > I'm only interested on clone post_syscall. I guess a function call is > expensive for waste twice this time on each system call. > > Is it possible to track only one system call number? Not without changing Valgrind's internals. Nick |
|
From: Oriol P. <aut...@gm...> - 2007-08-06 10:34:12
|
Hi, Thanks Nick. > My guess is that it wouldn't make much difference because system calls > should be relatively rare events, but I could be wrong. It depends on the > circumstance. Try doing some timings with and without entry/exit tracking. I will do some timings. > Not without changing Valgrind's internals. I guess it's not a useful functionality or not as useful as other possible functionalities. Only callgrind tool use post and pre syscall wrapper. Oriol |