[igt-dev] [PATCH i-g-t] tools/intel_gpu_top: Include total package power

Chris Wilson chris at chris-wilson.co.uk
Tue Nov 24 15:49:52 UTC 2020


Quoting Tvrtko Ursulin (2020-11-24 15:30:53)
> 
> On 24/11/2020 14:19, Chris Wilson wrote:
> > -static const char *rapl_gpu_power_unit(void)
> > -{
> > -     char buf[32];
> > -
> > -     if (filename_to_buf(RAPL_EVENT "energy-gpu.unit",
> > -                         buf, sizeof(buf)) == 0)
> > -             if (!strcmp(buf, "Joules"))
> > -                     return strdup("Watts");
> > -             else
> > -                     return strdup(buf);
> 
> We lose this handling of unexpected changes. Hard to decide if that is 
> very important. Should be possible to keep by a simple addition to 
> rapl_parse I think.

Do you think we need more than a fprintf(stderr) ?

	snprintf(buf, sizeof(buf), "events/energy-%s.unit", str);
        units = igt_sysfs_get(dir, buf);
        if (units && strcmp(units, "Joules"))
                fprintf(stderr, "Unexpected units for RAPL %s: found %s\n",
                        str, units);
	free(units);
-Chris


More information about the igt-dev mailing list