jonathan.a.spinks at jpmorgan.com
2007-Mar-09 02:41 UTC
[dtrace-discuss] DTrace Probe Timeout
Hi, Just wondering whether anyone knows how to timeout a dtrace script if a probe doesn''t fire within a specific time? I''m basically looking to probe a process to ensure that it is still firing syscalls. I will then wrap a shell script around this for automated alerting processes. However I have been unable to find a way of timing out the probe when there are no syscalls firing. Thanks for any help with this Regards Jon This communication is for informational purposes only. It is not intended as an offer or solicitation for the purchase or sale of any financial instrument or as an official confirmation of any transaction. All market prices, data and other information are not warranted as to completeness or accuracy and are subject to change without notice. Any comments or statements made herein do not necessarily reflect those of JPMorgan Chase & Co., its subsidiaries and affiliates. This transmission may contain information that is privileged, confidential, legally privileged, and/or exempt from disclosure under applicable law. If you are not the intended recipient, you are hereby notified that any disclosure, copying, distribution, or use of the information contained herein (including any reliance thereon) is STRICTLY PROHIBITED. Although this transmission and any attachments are believed to be free of any virus or other defect that might affect any computer system into which it is received and opened, it is the responsibility of the recipient to ensure that it is virus free and no responsibility is accepted by JPMorgan Chase & Co., its subsidiaries and affiliates, as applicable, for any loss or damage arising in any way from its use. If you received this transmission in error, please immediately contact the sender and destroy the material in its entirety, whether in electronic or hard copy format. Thank you. -------------- next part -------------- An HTML attachment was scrubbed... URL: <mail.opensolaris.org/pipermail/dtrace-discuss/attachments/20070309/d600678e/attachment.html>
Jonathan, The profile provider gives timer based probe firing. Let''s say you wanted to exit after 30 minutes: profile:::tick-30min { exit(0); } Will fire "every" 30 minutes, but since the probe clause has an exit(0), you''re only worried about the first 30 minutes. Which brings up a little hitch in this method. Every D program shares the same probes, so if your host happens to be running two scripts that both happen to be using the tick-30min probe, both scripts will react to the same firing, no matter when they were started. For example, if you started one of the scripts at 1:00PM, and the second one at 1:15PM, they would both exit at 1:30PM. So as long as you''re sure you''re script is the only one using that exact tick timer, or more precisely, as long as yours was first, the first pass will be accurate. Chip jonathan.a.spinks at jpmorgan.com wrote:> > Hi, > Just wondering whether anyone knows how to timeout a dtrace script if > a probe doesn''t fire within a specific time? > > I''m basically looking to probe a process to ensure that it is still > firing syscalls. I will then wrap a shell script around this for > automated alerting processes. However I have been unable to find a > way of timing out the probe when there are no syscalls firing. > > Thanks for any help with this > > Regards > Jon > This communication is for informational purposes only. It is not > intended as an offer or solicitation for the purchase or sale of any > financial instrument or as an official confirmation of any > transaction. All market prices, data and other information are not > warranted as to completeness or accuracy and are subject to change > without notice. Any comments or statements made herein do not > necessarily reflect those of JPMorgan Chase & Co., its subsidiaries > and affiliates. This transmission may contain information that is > privileged, confidential, legally privileged, and/or exempt from > disclosure under applicable law. If you are not the intended > recipient, you are hereby notified that any disclosure, copying, > distribution, or use of the information contained herein (including > any reliance thereon) is STRICTLY PROHIBITED. Although this > transmission and any attachments are believed to be free of any virus > or other defect that might affect any computer system into which it is > received and opened, it is the responsibility of the recipient to > ensure that it is virus free and no responsibility is accepted by > JPMorgan Chase & Co., its subsidiaries and affiliates, as applicable, > for any loss or damage arising in any way from its use. If you > received this transmission in error, please immediately contact the > sender and destroy the material in its entirety, whether in electronic > or hard copy format. Thank you. > ------------------------------------------------------------------------ > > _______________________________________________ > dtrace-discuss mailing list > dtrace-discuss at opensolaris.org
jonathan.a.spinks at jpmorgan.com wrote:> > I''m basically looking to probe a process to ensure that it is still > firing syscalls. I will then wrap a shell script around this for > automated alerting processes. However I have been unable to find a way > of timing out the probe when there are no syscalls firing. >The usual way is by using the profile provider, usually w/ a tick probe: See docs.sun.com/app/docs/doc/817-6223/6mlkidlf7?a=view dtrace:::BEGIN { i = 10; } profile:::tick-1sec /i > 0/ { i--; } profile:::tick-1sec /i == 0/ { exit(0); } Add the above to your script and it will run for only 10 seconds. -- Bart Smaalders Solaris Kernel Performance barts at cyber.eng.sun.com blogs.sun.com/barts
Jonathan, I like the one Bart showed us better for two reasons: 1) you don''t have to worry about the start-up problem, and 2) I was just thinking that you might have meant that you wanted to exit after X amount of time since the last syscall. In the script from the DTrace Guide, all you would need to do is reset the index "i" back to the starting value in the syscall''s probe clause. Despite the temptation to believe that the single "tick-30min" probe is more efficient, the difference is extremely insignificant. Chip Bart Smaalders wrote:> jonathan.a.spinks at jpmorgan.com wrote: >> >> I''m basically looking to probe a process to ensure that it is still >> firing syscalls. I will then wrap a shell script around this for >> automated alerting processes. However I have been unable to find a >> way of timing out the probe when there are no syscalls firing. >> > > The usual way is by using the profile provider, usually w/ a tick probe: > > See docs.sun.com/app/docs/doc/817-6223/6mlkidlf7?a=view > > dtrace:::BEGIN > { > i = 10; > } > > profile:::tick-1sec > /i > 0/ > { > i--; > } > > profile:::tick-1sec > /i == 0/ > { > exit(0); > } > > Add the above to your script and it will run for only 10 seconds. > >