I tried to implement (and eventually succeeded) structs in an iosnoop.d script.
#! /usr/sbin/dtrace -s
#pragma D option quiet
struct ioinfo {
uint64_t start;
string command;
int mypid;
};
struct ioinfo info[dev_t,uint64_t];
BEGIN
{
printf("%16s %5s %40s %10s %2s
%7s\n","COMMAND","PID","FILE","DEVICE","RW","MS");
}
io:::start
{
start[args[0]->b_edev,args[0]->b_blkno] = timestamp;
info[args[0]->b_edev,args[0]->b_blkno].start = timestamp;
info[args[0]->b_edev,args[0]->b_blkno].command = execname;
info[args[0]->b_edev,args[0]->b_blkno].mypid = pid;
}
io:::done
/ info[args[0]->b_edev,args[0]->b_blkno].start /
{
ela = timestamp - info[args[0]->b_edev,args[0]->b_blkno].start;
printf("%16s %5i %40s %10s %2s %3d.%03d\n",
info[args[0]->b_edev,args[0]->b_blkno].command,
info[args[0]->b_edev,args[0]->b_blkno].mypid,
args[2]->fi_pathname,
args[1]->dev_statname,
args[0]->b_flags&B_READ? "R":"W",
ela/1000000,
(ela/1000)%1000
);
info[args[0]->b_edev,args[0]->b_blkno].start = 0;
info[args[0]->b_edev,args[0]->b_blkno].command = 0;
info[args[0]->b_edev,args[0]->b_blkno].mypid = 0;
}
But while I was testing my this beta versions I got the following messages:
(during runtime, not during compilation, so the command was actually running)
dtrace: error on enabled probe ID 11 (ID 521: io:genunix:biodone:done): invalid
address (0x0) in action #10 at DIF offset 124
dtrace: error on enabled probe ID 11 (ID 521: io:genunix:biodone:done): invalid
address (0x0) in action #10 at DIF offset 124
Is there any indication in these messages as to where I should look in my
d-script for solving this problem. I think action #10 at DIF offset 124 is meant
as a pointer but how do I traces that back to lines in my d-script?
By the way: after long searching I found what my typo was.
Greetings,
Peter
This message posted from opensolaris.org