On Fri, Dec 02, 2005 at 11:20:23PM +0530, Ashutosh Kumar wrote:> > _______________________________________________ > dtrace-discuss mailing list > dtrace-discuss at opensolaris.orgDid you have a question? Cheers, - jonathan -- Jonathan Adams, Solaris Kernel Development
--
Nothing is impossible, except ''impossible'' itself.
-ashu
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: Dtrace-Formating-Output.txt
URL:
<http://mail.opensolaris.org/pipermail/dtrace-discuss/attachments/20051203/fc364c06/attachment.txt>
Hi Ashu,
The dtrace(1M) command is adding some new lines around the output of printa().
You can avoid this by adding your own format string for printa(). Try
something like this:
tick-5s
{
i = i + 5;
printf("%d ",i);
printa("%@u", @bytes);
printf("\n");
}
Adam
On Sat, Dec 03, 2005 at 01:23:40AM +0530, Ashutosh Kumar
wrote:>
> --
> Nothing is impossible, except ''impossible'' itself.
> -ashu
>
>
> Hi,
>
> I am trying to see the heap growth at the interval of 5 secs. Following is
my Dtrace script:
> ------------------------ Start of Dtrace script ------------------------
> #!/usr/sbin/dtrace -qs
>
> BEGIN
> {
> i = 0;
> }
>
> pid$target::malloc:entry
> {
> @bytes = sum(arg0);
> }
>
>
> tick-5s
> {
> i = i + 5;
> printf("%d",i);
> printa(@bytes);
> }
> ---------------------- End of Dtrace script -------------------------
>
> Output of the above script looks like this:
>
> 5
> 17136
> 10
> 31232
> 15
> 50288
> 20
>
> i.e. sampling interval and bytes allocated are printed in different lines,
however I am interested in seeing them in the same line. I want to see the
output in following format:
>
> 5 17136
> 10 31232
> 15 50288
>
> Any pointer would be appreciated.
>
> Thanks,
> Ashu.
> _______________________________________________
> dtrace-discuss mailing list
> dtrace-discuss at opensolaris.org
--
Adam Leventhal, Solaris Kernel Development http://blogs.sun.com/ahl
On Sat, Dec 03, 2005 at 01:23:40AM +0530, Ashutosh Kumar wrote:> Hi, > > I am trying to see the heap growth at the interval of 5 secs. Following is my Dtrace script: > ------------------------ Start of Dtrace script ------------------------ > #!/usr/sbin/dtrace -qs > > BEGIN > { > i = 0; > } > > pid$target::malloc:entry > { > @bytes = sum(arg0); > } > > > tick-5s > { > i = i + 5; > printf("%d",i); > printa(@bytes); > } > ---------------------- End of Dtrace script ------------------------- > > Output of the above script looks like this: > > 5 > 17136 > 10 > 31232 > 15 > 50288 > 20 > > i.e. sampling interval and bytes allocated are printed in different lines, however I am interested in seeing them in the same line. I want to see the output in following format: > > 5 17136 > 10 31232 > 15 50288 > > Any pointer would be appreciated.You just need to use an explicit format string: printf("%d", i); printa("\t%@d\n", @bytes); The "@" indicates that the aggregation value should be printed. Cheers, - jonathan -- Jonathan Adams, Solaris Kernel Development