Hi,
I'm trying to adapt the hotuser script
(http://www.brendangregg.com/DTrace/hotuser) so that I can give it some
context information.
As the first cut I have the following script which only prints profiling
information while inside a routine matching a pid:::entry probe and
taking more than so many microseconds to complete.
It seems to be working after a fashion, except that it seems to buffer
output from several activations of 'output routine' and print them all
at once, and then stop.
Also, the count always seems to be zero, for example here is some output:
CTX: _ZN4Foo3Blah10BlahManager16HandleTimerEv elapsed=4214519
PRO: 0x0 0
PRO: node-01.15.01`0x9984b0 0
PRO: node-01.15.01`0xef4e4c 0
PRO: node-01.15.01`0xef5e21 0
PRO: node-01.15.01`0xf00aab 0
PRO: 0xfffffd7ff7950208 0
PRO: libc.so.1`memmove+0x14 0
PRO: libc.so.1`realfree+0xa9 0
PRO: libc.so.1`pselect+0xd0 0
PRO: libc.so.1`_fcntl 0
PRO: libc.so.1`mutex_unlock+0xc 0
PRO: libc.so.1`gettimeofday+0x8 0
PRO: libm.so.2`log2_x+0xb3 0
END:
The process is a single threaded event loop using select and handling a
lot of sockets.
I'm wondering if I'm on the right track here and if anyone can offer any
advice. It would be great to have this working!
Cheers,
Jono Poff
......... Here is the script:
=====================================================
string context;
uint64_t ts;
BEGIN
{
context = "";
ts = 0;
}
pid$target::*HandleInput*:entry,
pid$target::*HandleOutput*:entry,
pid$target::*HandleTimer*:entry
/context == ""/
{
context = probefunc;
ts = timestamp;
}
profile:::profile-997hz
/pid == $target && ts > 0/
{
@pc[arg1] = count();
}
/* =============== output routine =========== */
pid$target::*HandleInput*:return,
pid$target::*HandleOutput*:return,
pid$target::*HandleTimer*:return
/context == probefunc && timestamp - ts > 10000/
{
printf("CTX: %s elapsed=%d\n", context, timestamp - ts);
printa("PRO: %A %@d\n", @pc);
printf("END:\n");
}
/* ======================================== */
pid$target::*HandleInput*:return,
pid$target::*HandleOutput*:return,
pid$target::*HandleTimer*:return
/context == probefunc/
{
context = "";
ts = 0;
clear(@pc);
}
====================================================
--
------------------------------
This email, including any attachments, is only for the intended recipient.
It is subject to copyright, is confidential and may be the subject of legal
or other privilege, none of which is waived or lost by reason of this
transmission.
If you are not an intended recipient, you may not use, disseminate,
distribute or reproduce such email, any attachments, or any part thereof.
If you have received a message in error, please notify the sender
immediately and erase all copies of the message and any attachments.
Unfortunately, we cannot warrant that the email has not been altered or
corrupted during transmission nor can we guarantee that any email or any
attachments are free from computer viruses or other conditions which may
damage or interfere with recipient data, hardware or software. The
recipient relies upon its own procedures and assumes all risk of use and of
opening any attachments.
------------------------------
-------------------------------------------
dtrace-discuss
Archives: https://www.listbox.com/member/archive/184261/=now
RSS Feed: https://www.listbox.com/member/archive/rss/184261/25769126-e243886f
Modify Your Subscription:
https://www.listbox.com/member/?member_id=25769126&id_secret=25769126-8d47a7b2
Powered by Listbox: http://www.listbox.com