Re: [igt-dev] [IGT 1/2] tools/intel_gpu_top: Add support for stdout logging

Eero Tamminen via igt-dev
2019-02-12T09:31:18Z

Hi,

On 11.2.2019 11.49, Tvrtko Ursulin wrote:
> On 08/02/2019 13:58, Eero Tamminen wrote:
>> On 8.2.2019 14.03, Tvrtko Ursulin wrote:
>>> From: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
>>>
>>> Two new output modes are added: listing of text data to standard out (-l
>>> on the command line), and dumping of JSON formatted records (-J),
>>> also to
>>> standard out.
>>>
>>> The first mode is selected automatically when non-interactive
>>> standard out
>>> is detected.
>>>
>>> Example of text output:
>>>
>>>   Freq MHz      IRQ RC6 Power     IMC MiB/s           RCS/0
>>> BCS/0           VCS/0           VCS/1          VECS/0
>>>   req  act       /s   %     W     rd     wr       %  se  wa       %
>>> se  wa       %  se  wa       %  se  wa       %  se  wa
>>>     0    0        0   0  0.00    360      0    0.00   0   0    0.00
>>> 0   0    0.00   0   0    0.00   0   0    0.00   0   0
>>>   350  350        0 100  0.00     35      2    0.00   0   0    0.00
>>> 0   0    0.00   0   0    0.00   0   0    0.00   0   0
>>>   350  350        0 100  0.00     34      2    0.00   0   0    0.00
>>> 0   0    0.00   0   0    0.00   0   0    0.00   0   0
>>>   350  350        0 100  0.00    143      6    0.00   0   0    0.00
>>> 0   0    0.00   0   0    0.00   0   0    0.00   0   0
>>>   350  350        0 100  0.00    169      7    0.00   0   0    0.00
>>> 0   0    0.00   0   0    0.00   0   0    0.00   0   0
>>>   350  350        0 100  0.00    169      7    0.00   0   0    0.00
>>> 0   0    0.00   0   0    0.00   0   0    0.00   0   0
>>
>> Looks nice!
>>
>> If you add '#' to the start of the header lines, one could use
>> something like the attached shell script to convert the saved output
>> to SVG graphs with GnuPlot.
>>
>> Before including the script to igt, it would need to be modified to
>> adapt to the number of engines, but maybe intel_gpu_top itself could
>> generate the gnuplot control file when it exits, if given e.g.
>> --gnuplot argument?
>
> Hello feature creep! :D
>
> I could add gnuplot output mode later, just to keep this stage simpler.
> In that case I would prefer that this mode outputs a single file (or
> stdout stream) which could be fed to gnuplot directly. Eg. intel_gpu_top
> -g -o file.out && gnuplot file.out, or even, intel_gpu_top -g | gnuplot.
> Quick googling shows it should be possible to embed the data in the
> "control file",

I didn't know that, but it seems simple. One just uses variable $name
for the data part instead of headers, and uses that variable name
instead of file name in plot commands after the data.

New enough GnuPlot version is in all distros which have new enough kernel.

> I am only not sure about the output filename in the
> second example. But anyway, first example should definitely work.

Gnuplot doesn't care about the control file name extension, and it can
read it from stdin. Both of these seem to work fine:
gnuplot - < plot.gnu
gnuplot < plot.gnu

- Eero