Alexandra (Sasha) Fedorova
2008-Jul-03 23:27 UTC
[dtrace-discuss] A simple question on adding new probes to the kernel
Hello,
In the past I used to use "printf" for observability in the newly
developed kernel components, and now I would like to switch to dtrace probes, as
this appears to be a cleaner approach.
I have tried adding/tracing new probes today, and I am having trouble tracing
the new Dtrace probes that I have added to the kernel.
I have added the following probes to ts.c (the time-sharing scheduling class
module that I am modifying):
DTRACE_SCHED3(schedctl__intxn, kthread_t *, t, txnid_t,
schedctl_get_txnid(t), txnver_t, schedctl_get_txnver(t));
DTRACE_SCHED(schedctl__notxn);
I have compiled the TS module and installed it on the system. I have tested that
my workload actually executed the code around these Dtrace probes by inserting
printfs right after the probes and by making sure that the output of those
printfs appear on the system console. So I assume that those probes must have
been triggered.
Then I have written the following dtrace script dtrace.d:
--- begin script ---
#!/usr/sbin/dtrace -s
sched:::schedctl-intxn
/execname == "settxnid"/
{
printf("Txn_id = %ld, txn_ver = %ld\n", arg1, arg2);
printf("In txn\n");
}
sched:::schedctl-notxn
/execname == "settxnid"/
{
}
--- end script ---
Then I ran dtrace as follows:
sudo ./dtrace.d
#!/usr/sbin/dtrace -s
dtrace script ''./dtrace.d'' matched 2 probes
(So my new probes were recognized)
Then I ran the workload that would trigger those probes, but the script did not
print anything. Yet, the output of my printfs (located just after those DTRACE
statements in the code) did appear on the console, indicating that the probes
were in fact triggered.
So it appears to me that the probes are triggered, but their output is not
displayed. Any ideas what I am doing wrong?
Thank you!
--
This message posted from opensolaris.org
S h i v
2008-Jul-04 03:50 UTC
[dtrace-discuss] A simple question on adding new probes to the kernel
On Fri, Jul 4, 2008 at 4:57 AM, Alexandra (Sasha) Fedorova <fedorova at cs.sfu.ca> wrote:> (So my new probes were recognized) > > Then I ran the workload that would trigger those probes, but the script did not print anything. Yet, the output of my printfs (located just after those DTRACE statements in the code) did appear on the console, indicating that the probes were in fact triggered. > > So it appears to me that the probes are triggered, but their output is not displayed. Any ideas what I am doing wrong? >Probes got enabled/triggered but the action didn''t get executed seem to indicate that the predicate didn''t get satisfied. Check if condition /execname == "settxnid"/ is right. -Shiv