[igt-dev] [RFC i-g-t] intel-gpu-top: Rewrite the tool to be safe to use

Rinat Ibragimov ibragimovrinat at mail.ru
Wed Mar 28 20:11:16 UTC 2018


>Среда, 28 марта 2018, 21:30 +03:00 от Tvrtko Ursulin <tursulin at ursulin.net>:
>

>+static struct engines *discover_engines(void)
> {
>-uint32_t devid = pci_dev->device_id;
>-uint16_t gcfgc;
>+const char *sysfs_root = "/sys/devices/i915/events";

Just a question.
I think, I have Linux 4.15.11 (from Debian testing) now. And there are no such files.
Are there any estimates about when this feature is expected to be available?

>-static void ring_init(struct ring *ring)
>+static uint64_t pmu_read_multi(int fd, unsigned int num, uint64_t *val)
> {
>-ring->size = (((ring_read(ring, RING_LEN) & RING_NR_PAGES) >> 12) + 1) * 4096;
>+uint64_t buf[2 + num];
>+unsigned int i;
>+
>+assert(read(fd, buf, sizeof(buf)) == sizeof(buf));

Will have undesired effects with NDEBUG.

>-int full;
>+uint64_t data[2];
> 
>-if (!ring->size)
>-return;
>+assert(read(fd, data, sizeof(data)) == sizeof(data));

Same here.

>+/* Get terminal size. */
>+if (ioctl(0, TIOCGWINSZ, &ws) != -1) {
>+con_w = ws.ws_col;
>+con_h = ws.ws_row;
>+}

If you move this into the loop itself, the tool will adapt to changes in
terminal width and height dynamically.

>-- 
>2.14.1
>
>_______________________________________________
>igt-dev mailing list
>igt-dev at lists.freedesktop.org
>https://lists.freedesktop.org/mailman/listinfo/igt-dev

---
Rinat


More information about the igt-dev mailing list