Guys can you give me some assistance with this: What I want is something like this Syscall count amount of time spent in syscall fstat 30 200 lwp_park 87540492 2000 what I have is the following: #!/usr/sbin/dtrace -s syscall:::entry /execname=="myapp"/ { self->ts = timestamp; @[probefunc]=count(); } syscall:::return //self->ts && execname == "ttcs"// { this->delta = (timestamp - self->ts) / 1000; self->ts = 0; } What I need is some way of associating the syscall, the count of times called and the total time spent altogether. Is this possible? Regards Damien
Damien, Aren''t you reinventing truss -c? Using DTrace, you can use 2 aggregations though the formatting won''t be exactly what you want: #!/usr/sbin/dtrace -s syscall:::entry /execname=="myapp"/ { self->ts = timestamp; @[probefunc]=count(); } syscall:::return /self->ts/ { this->delta = (timestamp - self->ts) / 1000; @totaltime[probefunc] = sum(this->delta); self->ts = 0; } END { printf("\nSyscall Count\n"); printa(@); printf("\nTotal time in Syscalls\n"); printa(@totaltime); } You could use associative arrays rather than aggregations to have complete control over the format, but they are not as efficient. Jim Damien Cooke wrote:> Guys can you give me some assistance with this: > > What I want is something like this > > Syscall count amount of time spent in syscall > fstat 30 200 > lwp_park 87540492 2000 > > what I have is the following: > > #!/usr/sbin/dtrace -s > syscall:::entry > /execname=="myapp"/ > { > self->ts = timestamp; > @[probefunc]=count(); > } > > syscall:::return > //self->ts && execname == "ttcs"// > { > this->delta = (timestamp - self->ts) / 1000; > self->ts = 0; > } > > What I need is some way of associating the syscall, the count of > times called and the total time spent altogether. Is this possible? > > Regards > Damien > _______________________________________________ > dtrace-discuss mailing list > dtrace-discuss at opensolaris.org
On Tue, Sep 06, 2005 at 09:02:17AM -0400, Jim Fiori wrote:> Aren''t you reinventing truss -c?Yes, but in a way that''s far less invasive to the process.> You could use associative arrays rather than aggregations to have > complete control over the format, but they are not as efficient.That''s not really true. Associative arrays are best used for storing intermediate value for your program; aggregations are better suited for storing information that will be output. Currently there''s no way of having a single key tuple with multiple aggregating functions, but that''s something we''re considering. Adam -- Adam Leventhal, Solaris Kernel Development http://blogs.sun.com/ahl