Alexander Kolbasov
2006-Nov-28 21:17 UTC
[dtrace-discuss] Aggregation results do not make any sense
I am using the following simple script on build 51 based bits (it has some kernel changes for CPU caps project) on amd64 with 64-bit kernel. ---------------------------------------------------------------------- #!/usr/sbin/dtrace -s fbt::ts_exit:entry /execname == "fork"/ { self->trace++; @exits["exits"] = count(); } /* * cap_project_charge is cpu-caps specific function * void cap_project_charge(kproject_t *kpj, int64_t nsecs) */ fbt::cap_project_charge:entry /self->trace/ { @f["charge count"] = count(); @b["charge average"] = avg(arg1); @c["charge min"] = min(arg1); @d["charge max"] = max(arg1); @e["charge quantaized"] = quantize(arg1); } fbt::ts_exit:return /self->trace/ { self->trace--; } ---------------------------------------------------------------------- After running for a while, it produces the following strange output. Notice the huge average value and also negative max value and both max and min inconsistent with quantized data: ---------------------------------------------------------------------- dtrace: script ''./aggbug.d'' matched 3 probes ^C exits 77252 charge count 74274 charge average 248360719409675 charge min 28415 charge max -8697972 charge quantaized value ------------- Distribution ------------- count -33554432 | 0 -16777216 | 98 -8388608 |@@@ 5052 -4194304 | 0 -2097152 | 0 -1048576 | 0 -524288 | 0 -262144 | 0 -131072 | 0 -65536 | 0 -32768 | 0 -16384 | 0 -8192 | 0 -4096 | 0 -2048 | 0 -1024 | 0 -512 | 0 -256 | 0 -128 | 0 -64 | 0 -32 | 0 -16 | 0 -8 | 0 -4 | 0 -2 | 0 -1 | 0 0 | 0 1 | 0 2 | 0 4 | 0 8 | 0 16 | 0 32 | 0 64 | 0 128 | 0 256 | 0 512 | 0 1024 | 0 2048 | 0 4096 | 0 8192 | 0 16384 | 1 32768 | 1 65536 | 0 131072 | 8 262144 |@ 2336 524288 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 66465 1048576 | 313 2097152 | 0 ---------------------------------------------------------------------- Any clues what is going on? __ - Alexander Kolbasov
Adam Leventhal
2006-Nov-30 19:35 UTC
[dtrace-discuss] Aggregation results do not make any sense
Hi Sasha, I think the problem you''re seeing is that the avg(), min(), and max() aggregating actions treat their argument as unsigned while the quantize() aggregating action treats it as signed (though max() is obviously printing its result as signed). You''re obviously dealing with large values -- can you try scaling them down before quantizing? Adam On Tue, Nov 28, 2006 at 01:17:13PM -0800, Alexander Kolbasov wrote:> I am using the following simple script on build 51 based bits (it has some > kernel changes for CPU caps project) on amd64 with 64-bit kernel. > > ---------------------------------------------------------------------- > #!/usr/sbin/dtrace -s > > fbt::ts_exit:entry > /execname == "fork"/ > { > self->trace++; > @exits["exits"] = count(); > } > > /* > * cap_project_charge is cpu-caps specific function > * void cap_project_charge(kproject_t *kpj, int64_t nsecs) > */ > > fbt::cap_project_charge:entry > /self->trace/ > { > @f["charge count"] = count(); > @b["charge average"] = avg(arg1); > @c["charge min"] = min(arg1); > @d["charge max"] = max(arg1); > @e["charge quantaized"] = quantize(arg1); > } > > fbt::ts_exit:return > /self->trace/ > { > self->trace--; > } > ---------------------------------------------------------------------- > > After running for a while, it produces the following strange output. Notice the > huge average value and also negative max value and both max and min inconsistent > with quantized data: > > ---------------------------------------------------------------------- > dtrace: script ''./aggbug.d'' matched 3 probes > ^C > exits 77252 > charge count 74274 > charge average 248360719409675 > charge min 28415 > charge max -8697972 > charge quantaized > value ------------- Distribution ------------- count > -33554432 | 0 > -16777216 | 98 > -8388608 |@@@ 5052 > -4194304 | 0 > -2097152 | 0 > -1048576 | 0 > -524288 | 0 > -262144 | 0 > -131072 | 0 > -65536 | 0 > -32768 | 0 > -16384 | 0 > -8192 | 0 > -4096 | 0 > -2048 | 0 > -1024 | 0 > -512 | 0 > -256 | 0 > -128 | 0 > -64 | 0 > -32 | 0 > -16 | 0 > -8 | 0 > -4 | 0 > -2 | 0 > -1 | 0 > 0 | 0 > 1 | 0 > 2 | 0 > 4 | 0 > 8 | 0 > 16 | 0 > 32 | 0 > 64 | 0 > 128 | 0 > 256 | 0 > 512 | 0 > 1024 | 0 > 2048 | 0 > 4096 | 0 > 8192 | 0 > 16384 | 1 > 32768 | 1 > 65536 | 0 > 131072 | 8 > 262144 |@ 2336 > 524288 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 66465 > 1048576 | 313 > 2097152 | 0 > > ---------------------------------------------------------------------- > > Any clues what is going on? > > __ > - Alexander Kolbasov > _______________________________________________ > dtrace-discuss mailing list > dtrace-discuss at opensolaris.org-- Adam Leventhal, Solaris Kernel Development http://blogs.sun.com/ahl
Alexander Kolbasov
2006-Dec-01 20:09 UTC
[dtrace-discuss] Aggregation results do not make any sense
> Hi Sasha, > > I think the problem you''re seeing is that the avg(), min(), and max() > aggregating actions treat their argument as unsigned while the quantize() > aggregating action treats it as signed (though max() is obviously printing > its result as signed).The values I am dealing with are signed. Is there any reason that avg() min() and max() treat their arguments as unsigned? Would it be a useful RFE to have signed version of these?> You''re obviously dealing with large values -- can you try scaling them > down before quantizing?I can, but it seems that here the problem is not with large values but with negative values. - Alex Kolbasov __ http://blogs.sun.com/akolb> > Adam > > On Tue, Nov 28, 2006 at 01:17:13PM -0800, Alexander Kolbasov wrote: > > I am using the following simple script on build 51 based bits (it has some > > kernel changes for CPU caps project) on amd64 with 64-bit kernel. > > > > ---------------------------------------------------------------------- > > #!/usr/sbin/dtrace -s > > > > fbt::ts_exit:entry > > /execname == "fork"/ > > { > > self->trace++; > > @exits["exits"] = count(); > > } > > > > /* > > * cap_project_charge is cpu-caps specific function > > * void cap_project_charge(kproject_t *kpj, int64_t nsecs) > > */ > > > > fbt::cap_project_charge:entry > > /self->trace/ > > { > > @f["charge count"] = count(); > > @b["charge average"] = avg(arg1); > > @c["charge min"] = min(arg1); > > @d["charge max"] = max(arg1); > > @e["charge quantaized"] = quantize(arg1); > > } > > > > fbt::ts_exit:return > > /self->trace/ > > { > > self->trace--; > > } > > ---------------------------------------------------------------------- > > > > After running for a while, it produces the following strange output. Notice the > > huge average value and also negative max value and both max and min inconsistent > > with quantized data: > > > > ---------------------------------------------------------------------- > > dtrace: script ''./aggbug.d'' matched 3 probes > > ^C > > exits 77252 > > charge count 74274 > > charge average 248360719409675 > > charge min 28415 > > charge max -8697972 > > charge quantaized > > value ------------- Distribution ------------- count > > -33554432 | 0 > > -16777216 | 98 > > -8388608 |@@@ 5052 > > -4194304 | 0 > > -2097152 | 0 > > -1048576 | 0 > > -524288 | 0 > > -262144 | 0 > > -131072 | 0 > > -65536 | 0 > > -32768 | 0 > > -16384 | 0 > > -8192 | 0 > > -4096 | 0 > > -2048 | 0 > > -1024 | 0 > > -512 | 0 > > -256 | 0 > > -128 | 0 > > -64 | 0 > > -32 | 0 > > -16 | 0 > > -8 | 0 > > -4 | 0 > > -2 | 0 > > -1 | 0 > > 0 | 0 > > 1 | 0 > > 2 | 0 > > 4 | 0 > > 8 | 0 > > 16 | 0 > > 32 | 0 > > 64 | 0 > > 128 | 0 > > 256 | 0 > > 512 | 0 > > 1024 | 0 > > 2048 | 0 > > 4096 | 0 > > 8192 | 0 > > 16384 | 1 > > 32768 | 1 > > 65536 | 0 > > 131072 | 8 > > 262144 |@ 2336 > > 524288 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 66465 > > 1048576 | 313 > > 2097152 | 0 > > > > ---------------------------------------------------------------------- > > > > Any clues what is going on? > > > > __ > > - Alexander Kolbasov > > _______________________________________________ > > dtrace-discuss mailing list > > dtrace-discuss at opensolaris.org > > -- > Adam Leventhal, Solaris Kernel Development http://blogs.sun.com/ahl >