This is the mail archive of the
systemtap@sourceware.org
mailing list for the systemtap project.
RE: sort a foreach on a stat value?
- From: "Stone, Joshua I" <joshua dot i dot stone at intel dot com>
- To: <systemtap at sources dot redhat dot com>
- Date: Wed, 11 Jan 2006 11:41:56 -0800
- Subject: RE: sort a foreach on a stat value?
Bump.
Nobody has an opinion about this?
Stone, Joshua I wrote:
> Do we have a syntax to sort a foreach based on a stat value?
> Obviously this doesn't make sense for a histogram, but for the
> others, like @count, it seems that this would very often be what a
> user would want to do.
>
> For example - here's an unscalable way to do simple thread profiling:
>
> global stat
> probe my.event { ++stat[tid()] }
> probe end {
> foreach(tid in stat-) // sort by value -> most active
> printf("%d: %d\n", tid, stat[tid])
> }
>
> The scalable, per-cpu way to do this is:
>
> global stat
> probe my.event { stat[tid()]<<<1 }
> probe end {
> foreach(tid in stat-) // sort by value -> ???
> printf("%d: %d\n", tid, @count(stat[tid]))
> }
>
> But there doesn't seem to be a way to achieve the same sorting.
>
> Along the same lines, it would be extremely useful to be able to do
> "cascading" sort - i.e. sort by more than one field.
>
>
> Josh