G'Fay Folks,
On Wed, Nov 14, 2007 at 03:10:05PM -0600, jorge gmail wrote:
>
>
> Hi all, i write a little program that could be useful if you have
> DtraceToolkit. Almost all scripts wait until you press ctrl+c key, but
>
> If want to automate this task this is not possible because you need to stay
> in front of your terminal.
Sorry, I haven't documented this in the DTraceToolkit yet (it should be under
Notes/ALLautomation.txt), and I apologize, but there is an easy way to
automate most of them. For example:
# ./mmapfiles.d
Tracing... Hit Ctrl-C to end.
^C
Lets say I wanted that to run for 10 seconds only; since it is a .d script,
expressions can be added to the command line:
# ./mmapfiles.d -n 'tick-10sec { exit(0); }'
Tracing... Hit Ctrl-C to end.
MMAPS CMD PATHNAME
1 date /var/ld/ld.config
1 ls /var/ld/ld.config
3 date /lib/libc.so.1
3 ls /lib/libavl.so.1
3 ls /lib/libc.so.1
3 ls /lib/libsec.so.1
Now it runs for 10 seconds. Usually. The profile:::tick-10sec probe can
hook onto a pre-existing enabling of profile:::tick-10sec, if someone
else was running it on the same system, meaning that it could exit much
sooner than 10 seconds. This could be improved using:
# ./mmapfiles.d -n 'tick-1sec /++i == 10/ { exit(0); }'
Tracing... Hit Ctrl-C to end.
MMAPS CMD PATHNAME
1 date /var/ld/ld.config
3 date /lib/libc.so.1
Now it will be much closer to 10 seconds (between 9 and 10). It could
user tick-10hz to get within 9.9 and 10.0, if needed.
Some scripts in the DTraceToolkit are wrapped in Perl or shell, and don't
have the .d extension, and can't use this trick. Some of those have
an interval and count as options, which can be used instead. That leaves
several scripts with no way of automating the time; which shouldn't take
me too long to fix for the next version of the toolkit (it's already on
my todo list).
In the meantime, if you have a script that isn't *.d, that doesn't
provide interval and count, then you can either edit the script to add
that functionality, or use Ktime.
> Ktime launch the program passed as parameter and wait <time> ( in seconds)
> until send a ctr+c signal ( SIGINT) to the child process.
>
> http://kbradero.neuroaio.biz/gnu/ktime/ktime.c ( source code online )
>
> http://kbradero.neuroaio.biz/gnu/ktime/solaris/ binary
>
> Examples :
>
> ./ktime shortlived.d 20
>
>
> Syntaxis:
>
> ./ktime <program> <time>
>
[...]
Cool; there have certainly been times in the past where Ktime would have
been handy, and it can still serve a purpose for some of the toolkit
scripts.
thanks,
Brendan
--
Brendan
[CA, USA]
_______________________________________________
dtrace-discuss mailing list
[email protected]