Yossi Lev
2010-May-07 19:32 UTC
[dtrace-discuss] Truncating multiple aggregations according to the values in one of them
Hi I''m using a single printa statement to print multiple aggregations, and I would like to only show the N lines with the highest value for one of the printed columns. E.g: printa("%d %@d %@d\n", @totalCost, @totalOccurrences); and I would like to show the 10 lines with the highest total cost. Truncating only @totalCost wouldn''t work because when printing multiple aggregations, a line is printed for each key in the *union* of all presented aggregations. Truncating both aggregations wouldn''t work either because trunc(@totalOccurrences, 10) may remove different keys than trunc(@totalCost, 10) as each truncation is done according to different values. Any suggestions? I know I can post-process the output, but would like to check first if there is an option to take care of this in the DTrace script itself. Thanks, Yossi -- This message posted from opensolaris.org
Adam Leventhal
2010-May-11 23:45 UTC
[dtrace-discuss] Truncating multiple aggregations according to the values in one of them
Hey Yossi, We don''t have a good solution, but there is an RFE filed on this: 6886670 trunc(@a, @b, @c, @d, @e, ..., 20); Adam On May 7, 2010, at 12:32 PM, Yossi Lev wrote:> Hi > > I''m using a single printa statement to print multiple aggregations, and I would like to only show the N lines with the highest value for one of the printed columns. E.g: > > printa("%d %@d %@d\n", @totalCost, @totalOccurrences); > > and I would like to show the 10 lines with the highest total cost. > > Truncating only @totalCost wouldn''t work because when printing multiple aggregations, a line is printed for each key in the *union* of all presented aggregations. > Truncating both aggregations wouldn''t work either because trunc(@totalOccurrences, 10) may remove different keys than trunc(@totalCost, 10) as each truncation is done according to different values. > > Any suggestions? > I know I can post-process the output, but would like to check first if there is an option to take care of this in the DTrace script itself. > > Thanks, > Yossi > -- > This message posted from opensolaris.org > _______________________________________________ > dtrace-discuss mailing list > dtrace-discuss at opensolaris.org-- Adam Leventhal, Fishworks http://blogs.sun.com/ahl