On Tue, Nov 18, 2008 at 06:55:09AM -0800, Adam Mitchell wrote:
> When printa() prints quantize data, you get the nice ascii art by default.
> Can you change the format so that it's all on one line and easier to parse?
Hey Adam,
There isn't a way to format the results of a quantize action. The closest
think I can think of is to change use the count() aggregating action keyed
by what would have been the argument to quantize:
---8<---
#!/usr/sbin/dtrace -s
#pragma D option aggsortkey
syscall::write:entry
{
this->a = arg2;
this->k = (this->a == 0) ? 0 : 1;
this->k += (this->a & 0xffffffff00000000ULL) ? 32 : 0;
this->a = (this->a & 0xffffffff00000000ULL) ? (this->a >> 32) : this->a;
this->k += (this->a & 0xffff0000) ? 16 : 0;
this->a = (this->a & 0xffff0000) ? (this->a >> 16) : this->a;
this->k += (this->a & 0xff00) ? 8 : 0;
this->a = (this->a & 0xff00) ? (this->a >> 8) : this->a;
this->k += (this->a & 0xf0) ? 4 : 0;
this->a = (this->a & 0xf0) ? (this->a >> 4) : this->a;
this->k += (this->a & 0xc) ? 2 : 0;
this->a = (this->a & 0xc) ? (this->a >> 2) : this->a;
this->k += (this->a & 0x2) ? 1 : 0;
this->a = (this->a & 0x2) ? (this->a >> 1) : this->a;
@a[this->k] = count();
@b = quantize(arg2);
}
---8<---
Adam
--
Adam Leventhal, Fishworks http://blogs.sun.com/ahl
_______________________________________________
dtrace-discuss mailing list
[email protected]