[Intel-gfx] [RFC 8/8] drm/i915: Expose per-engine client busyness
Chris Wilson
chris at chris-wilson.co.uk
Thu Dec 19 21:23:27 UTC 2019
Quoting Tvrtko Ursulin (2019-12-19 18:00:19)
> + for (i = 0;
> + client->busy_root && i < ARRAY_SIZE(uabi_class_names);
> + i++) {
> + struct i915_engine_busy_attribute *i915_attr =
> + &client->attr.busy[i];
> +
> + i915_attr->client = client;
> + i915_attr->engine_class = i;
> +
> + attr = &i915_attr->attr;
> +
> + sysfs_attr_init(&attr->attr);
> +
> + attr->attr.name = uabi_class_names[i];
> + attr->attr.mode = 0444;
> + attr->show = show_client_busy;
> +
> + ret = sysfs_create_file(client->busy_root,
> + (struct attribute *)attr);
Do we need to hold a reference from the open file to the
i915_drm_client?
fd = open("/sys/i915/clients/0/0", O_RDONLY);
v[0] = read_u64(fd);
sleep(2); rewind(fd);
v[1] = read_u64(fd);
close(fd);
I was thinking whether or not poll("/sys/i915/clients") would return
events for new clients and so whether or not we could do something like
if (poll("/sys/i915/clients", timeout) > 0) {
for_each_new_client:
client = open("/sys/i915/client/$id");
}
for_each_client:
printf("%s: {rcs:%llu, ...}", client->name, read_u64(client->rcs));
Might be a bit heavy on the fds :)
-Chris
More information about the Intel-gfx
mailing list