Re: [igt-dev] [PATCH i-g-t v2] lib: Add GPU power measurement

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Quoting Tvrtko Ursulin (2019-03-26 09:52:05)
> 
> On 26/03/2019 09:18, Chris Wilson wrote:
> > +static int rapl_parse(struct rapl *r)
> > +{
> > +     locale_t locale, oldlocale;
> > +     int dir;
> > +
> > +     dir = open("/sys/devices/power", O_RDONLY);
> > +     if (dir < 0)
> > +             return -errno;
> > +
> > +     /* Replace user environment with plain C to match kernel format */
> > +     locale = newlocale(LC_ALL, "C", 0);
> > +     oldlocale = uselocale(locale);
> > +
> > +     memset(r, 0, sizeof(*r));
> > +     igt_sysfs_scanf(dir, "type", "%"PRIu64, &r->type);
> > +     igt_sysfs_scanf(dir, "events/energy-gpu", "event=%"PRIx64, &r->power);
> > +     igt_sysfs_scanf(dir, "events/energy-gpu.scale", "%lf", &r->scale);
> 
> Check return codes?

I was being lazy and hoping r->scale sorted that all out.
-Chris
_______________________________________________
Intel-gfx mailing list
Intel-gfx@xxxxxxxxxxxxxxxxxxxxx
https://lists.freedesktop.org/mailman/listinfo/intel-gfx




[Index of Archives]     [AMD Graphics]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux