This is the mail archive of the systemtap@sourceware.org mailing list for the systemtap project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: stap -x option


Sanket Somnath Hase wrote:
Hi folks,

a ) I was curious to know if we can provide more than one target to stap. Say I want to run the same script for more than one processes .

b) Is there any benefit in running single script ( effectively single kernel module ) for all the processes under consideration against running same script for each process individually ( and effectively having many kernel modules which look for same set of events but for different targets ).

Looking forward to hear from you ,

Thanks ,
Sanket


It seems like one could have a begin probe parse a string argument with the list of pid interested in and enter them into a associative array using strtol and tokenize functions in a begin probe. Then have the probe check the associative array each time it fires. Maybe something like the attached script. This will need a newer version of systemtap that include the tokenize() function. The comment for syscall.read show how to check the associative array. Running the example something like this:


stap pids2watch.stp "124 456"
watching pids:
124
456


There are two issues with multiple probes. One is there will be additional overhead if there are more probes to run at a probe point. The other issue is that systemtap avoids recompiling the scripts when possible. It checks to see if a kernel module has been previously generated for a script, if so it reuses the module. If you attempt to use multiple instances of a script, systemtap may indicate that it can't load the module. The kernel only allow one instance of a module to be loaded into the kernel. You may need to resort to using the "-m" option to produce different modules to load.


-Will


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]