3

I wanted to inspect some metrics of a buffering queue and sort entries shown by perf top according to the number of items queued in the buffer at any given trace point.

However, when I specified the number-of-items field as the primary sort key, it didn't sort according to this key at all. As an example, I use the net:net_dev_xmit static trace point and the following command

perf top -e net:net_dev_xmit -s len,overhead

The output after a few seconds of playing with the web-browser is the following

Samples: 208  of event 'net:net_dev_xmit', Event count (approx.): 155
Overhead         len
0,65%            232
0,65%            214
0,65%            192
0,65%            183
5,16%           1432
0,65%            152

As can be seen, it doesn't sort according to overhead anymore, as per my request. But it didn't sort according to len either! At least there's no apparent total order in the output.

At some point, I suspected that it might use alphanumeric descending order, but that's not the case either because 1432 is printed before 152, but alphanumeric descending sorting would order the prefix 14 after prefix 15.

What's going on here?

7
  • I don't think you can sort by len. Try perf top -e net:net_dev_xmit -s overhead.
    – Hadi Brais
    May 20, 2018 at 0:54
  • @Hadi but why is it possible to specify it as a sort key, then? May 20, 2018 at 7:42
  • The sorting switch only works on keys that perf has built-in knowledge of. This includes the overhead key, but not len. I think if you specify an unsupported key, perf will just ignore it or it seems that it's ignoring the whole sorting switch.
    – Hadi Brais
    May 20, 2018 at 16:03
  • Actually, can you try perf top -e net:net_dev_xmit -s overhead,len? That is, switch len and overhead. I expect this to sort only by the overhead.
    – Hadi Brais
    May 20, 2018 at 16:12
  • @HadiBrais thanks, I see. Interestingly, one cannot specify the key on --fields, which is just the opposite of what I would have expected in such a case (accept for --fields, and reject for --sort). Re the switching: yes, that's the default behavior, but it's not what I want, because it wouldn't sort for len, but for overhead. May 20, 2018 at 16:49

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.