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

Chris Wilson
2019-02-08T12:10:26Z

Quoting Tvrtko Ursulin (2019-02-08 12:03:50)
> 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
>
> Example of JSON output:
>
> {
> "period": {
> "duration": 1002.525224,
> "unit": "ms"
> },
> "frequency": {
> "requested": 349.118398,
> "actual": 349.118398,
> "unit": "MHz"
> },
> "interrupts": {
> "count": 0.000000,
> "unit": "irq/s"
> },
> "rc6": {
> "value": 99.897752,
> "unit": "%"
> },
> "power": {
> "value": 0.000000,
> "unit": "W"
> },
> "imc-bandwidth": {
> "reads": 149.683843,
> "writes": 6.104093,
> "unit": "MiB/s"
> },
> "engines": {
> "Render/3D/0": {

Stale output? Didn't you switch to the bspec names?
"${class}${instance}": {

> + ret = snprintf(buf, sizeof(buf), "%s/%u",

"%s/%u", we don't use a slash separator elsewhere?

> + class_short_name(engine->class),
> + engine->instance);
> + if (ret < 0 || ret == sizeof(buf)) {
> + ret = ENOBUFS;
> + break;
> + }
> +
> + engine->short_name = strdup(buf);

asprintf(&engine->short_name ...);
-Chris