From patchwork Thu Oct 12 08:15:39 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tvrtko Ursulin X-Patchwork-Id: 13418489 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 2D14BCDB46E for ; Thu, 12 Oct 2023 08:16:04 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 6F67110E468; Thu, 12 Oct 2023 08:15:59 +0000 (UTC) Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.9]) by gabe.freedesktop.org (Postfix) with ESMTPS id EABE210E442; Thu, 12 Oct 2023 08:15:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1697098558; x=1728634558; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=fHoj1IsAZty2I0ZpHfNKydpjxbohb3jClnXT5IDWVHs=; b=GpEULarO3f6Fn7dxvRwtlqXnsPaNr+W99UbVQ9+j4zSmQbhDB9/M6AVI VrdqqaUxAqAQZTaXGNP8i3LAKS+UH3LkKfElAIRp+L0UX7I3s/x3+foce xKCj7RDu20FiTtKuB/xZvjyQQI0XWBEC0DkyihFU8UykSMkBfMralZxAv IacWAuWpXppiG/EkIhXGXK7iXTRj7wyfovGdYPl8jGIJ0HW/sCGZoy15I lZDAZPAgqIwiex2vf4TE8Wax1MYa5zX9cu9yfThq8uuH/m5eFOWvVfi2j IKmL8axk6x+6fbqGkPmhbTWbuOsd3XoGj36QqDeUIxWq2ZW5pJOOWxkUi g==; X-IronPort-AV: E=McAfee;i="6600,9927,10860"; a="3454673" X-IronPort-AV: E=Sophos;i="6.03,218,1694761200"; d="scan'208";a="3454673" Received: from orsmga008.jf.intel.com ([10.7.209.65]) by orvoesa101.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 12 Oct 2023 01:15:57 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10860"; a="783599294" X-IronPort-AV: E=Sophos;i="6.03,218,1694761200"; d="scan'208";a="783599294" Received: from maloneyj-mobl.ger.corp.intel.com (HELO localhost.localdomain) ([10.213.239.225]) by orsmga008-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 12 Oct 2023 01:15:55 -0700 From: Tvrtko Ursulin To: igt-dev@lists.freedesktop.org, Intel-gfx@lists.freedesktop.org Date: Thu, 12 Oct 2023 09:15:39 +0100 Message-Id: <20231012081547.852052-2-tvrtko.ursulin@linux.intel.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20231012081547.852052-1-tvrtko.ursulin@linux.intel.com> References: <20231012081547.852052-1-tvrtko.ursulin@linux.intel.com> MIME-Version: 1.0 Subject: [Intel-gfx] [PATCH i-g-t 1/9] tests/i915/drm_fdinfo: Check engine info is supported X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Tvrtko Ursulin Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" From: Tvrtko Ursulin On top of checking that parsing works, check that there are some engines present. This will be needed once the memory stats are added and so return value from __igt_parse_drm_fdinfo() will then be possible to be greater than zero even when engine stats are not supported. Signed-off-by: Tvrtko Ursulin Reviewed-by: Kamil Konieczny --- tests/intel/drm_fdinfo.c | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/intel/drm_fdinfo.c b/tests/intel/drm_fdinfo.c index aca19db50680..344c44dce78b 100644 --- a/tests/intel/drm_fdinfo.c +++ b/tests/intel/drm_fdinfo.c @@ -737,6 +737,7 @@ igt_main igt_require_gem(i915); igt_require(igt_parse_drm_fdinfo(i915, &info, NULL, 0, NULL, 0)); + igt_require(info.num_engines); ctx = intel_ctx_create_all_physical(i915); From patchwork Thu Oct 12 08:15:40 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tvrtko Ursulin X-Patchwork-Id: 13418490 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id EB621CDB46E for ; Thu, 12 Oct 2023 08:16:06 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 96A4610E45F; Thu, 12 Oct 2023 08:16:01 +0000 (UTC) Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.9]) by gabe.freedesktop.org (Postfix) with ESMTPS id 4965110E450; Thu, 12 Oct 2023 08:15:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1697098559; x=1728634559; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=3nWxMUgQDs+lJ2jqZ/3fRn69jkLn2xn7nq16lXtvZgI=; b=VPUFPXQxC5KnkaybCO9G5k8axTEHV4kXOd347E+sldLyNsTnz0IJbztp X2m4eoMXwl6YAitEI0wR75cTBSdPJYpIgYRod13Lp6m507l0UV+fXInnZ 1uCWoWGe4AIihJc5feZMTiXgiOUNLJhh3mfz1hMnSYpZlV2XGd4TQtxdC ug+GNuqOe40cbDUFHzZK0LO8HqAMhMpxc3IvpMttlBUrgezc3iJTKyk0/ jE6l2kgpgwLzn9hOYe7GSEWjLKcrtMGfchwEmxIkiKGtc8JW/FEIeedbQ Lux+2PqGnJxFINAfwy99iS0Bv0/8+prvmdEaWGLZM8YjTl5Bq4YRObfuC A==; X-IronPort-AV: E=McAfee;i="6600,9927,10860"; a="3454675" X-IronPort-AV: E=Sophos;i="6.03,218,1694761200"; d="scan'208";a="3454675" Received: from orsmga008.jf.intel.com ([10.7.209.65]) by orvoesa101.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 12 Oct 2023 01:15:59 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10860"; a="783599302" X-IronPort-AV: E=Sophos;i="6.03,218,1694761200"; d="scan'208";a="783599302" Received: from maloneyj-mobl.ger.corp.intel.com (HELO localhost.localdomain) ([10.213.239.225]) by orsmga008-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 12 Oct 2023 01:15:56 -0700 From: Tvrtko Ursulin To: igt-dev@lists.freedesktop.org, Intel-gfx@lists.freedesktop.org Date: Thu, 12 Oct 2023 09:15:40 +0100 Message-Id: <20231012081547.852052-3-tvrtko.ursulin@linux.intel.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20231012081547.852052-1-tvrtko.ursulin@linux.intel.com> References: <20231012081547.852052-1-tvrtko.ursulin@linux.intel.com> MIME-Version: 1.0 Subject: [Intel-gfx] [PATCH i-g-t 2/9] tests/i915/drm_fdinfo: Stress test context close versus fdinfo reads X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Tvrtko Ursulin Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" From: Tvrtko Ursulin A short smoke tests to exercise fdinfo reads in parallel to contexts getting created and destroyed. Signed-off-by: Tvrtko Ursulin Reviewed-by: Kamil Konieczny --- tests/intel/drm_fdinfo.c | 68 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 68 insertions(+) diff --git a/tests/intel/drm_fdinfo.c b/tests/intel/drm_fdinfo.c index 344c44dce78b..c4218b0d16e6 100644 --- a/tests/intel/drm_fdinfo.c +++ b/tests/intel/drm_fdinfo.c @@ -22,11 +22,14 @@ * */ +#include + #include "igt.h" #include "igt_core.h" #include "igt_device.h" #include "igt_drm_fdinfo.h" #include "i915/gem.h" +#include "i915/gem_create.h" #include "i915/gem_vm.h" #include "intel_ctx.h" /** @@ -72,6 +75,8 @@ * SUBTEST: virtual-busy-idle-all * * SUBTEST: virtual-idle + * + * SUBTEST: context-close-stress */ IGT_TEST_DESCRIPTION("Test the i915 drm fdinfo data"); @@ -717,6 +722,56 @@ virtual_all(int i915, const intel_ctx_cfg_t *base_cfg, unsigned int flags) } } +static void stress_context_close(int i915) +{ + const uint32_t bbe = MI_BATCH_BUFFER_END; + struct igt_helper_process reader = { }; + struct drm_client_fdinfo info; + uint32_t batch; + int dir, ret; + char buf[64]; + + ret = snprintf(buf, sizeof(buf), "%u", i915); + igt_assert(ret > 0 && ret < sizeof(buf)); + + dir = open("/proc/self/fdinfo", O_DIRECTORY | O_RDONLY); + igt_assert_fd(dir); + + memset(&info, 0, sizeof(info)); + ret = __igt_parse_drm_fdinfo(dir, buf, &info, NULL, 0, NULL, 0); + igt_assert(ret > 0); + igt_require(info.num_regions); + + batch = gem_create(i915, 4096); + gem_write(i915, batch, 0, &bbe, sizeof(bbe)); + + igt_fork_helper(&reader) { + for (;;) { + memset(&info, 0, sizeof(info)); + ret = __igt_parse_drm_fdinfo(dir, buf, &info, + NULL, 0, NULL, 0); + igt_assert(ret > 0); + } + } + + igt_until_timeout(10) { + struct drm_i915_gem_exec_object2 obj = { + .handle = batch, + }; + struct drm_i915_gem_execbuffer2 eb = { + .buffers_ptr = to_user_pointer(&obj), + .buffer_count = 1, + }; + + eb.rsvd1 = gem_context_create(i915); + igt_assert(eb.rsvd1); + gem_execbuf(i915, &eb); + gem_context_destroy(i915, eb.rsvd1); + } + + igt_stop_helper(&reader); +} + #define test_each_engine(T, i915, ctx, e) \ igt_subtest_with_dynamic(T) for_each_ctx_engine(i915, ctx, e) \ igt_dynamic_f("%s", e->name) @@ -848,6 +903,19 @@ igt_main test_each_engine("isolation", i915, ctx, e) single(i915, ctx, e, TEST_BUSY | TEST_ISOLATION); + igt_subtest_group { + int newfd; + + igt_fixture + newfd = drm_reopen_driver(i915); + + igt_subtest("context-close-stress") + stress_context_close(newfd); + + igt_fixture + drm_close_driver(newfd); + } + igt_fixture { intel_ctx_destroy(i915, ctx); drm_close_driver(i915); From patchwork Thu Oct 12 08:15:41 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tvrtko Ursulin X-Patchwork-Id: 13418491 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 694ABCDB47E for ; Thu, 12 Oct 2023 08:16:09 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 373A810E45A; Thu, 12 Oct 2023 08:16:02 +0000 (UTC) Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.9]) by gabe.freedesktop.org (Postfix) with ESMTPS id C974110E46F; Thu, 12 Oct 2023 08:15:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1697098560; x=1728634560; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=PRebmyDH50utciPFwqa7O3shuhf57IGoHhVfz8Wwcuw=; b=fY9WIdKJ17lEGjC2iXmtikoJUHKx33HttWZMvonWJ8uVz64RivKBkt8Q Gc2JzDOy4wOLkTL9/2ec/8eOlTeVCSJkktCc8o5f4JTHuL9tGy3mfEZ7z z4+D3AYiAF+LsS2zM2wslGZaCFsH8OBw0ITod140dGX9r8dtP0MhiRHXW 9JmHMDleyofudF/UrVkAWnqLnHN91u0VrFhoKsKauxoRud3PvsX0VbJcv qE0OZeOkSqz9VrX6wf3tX2eee8Wrj27qTWzq/h84LXS0tNlbejf/WC74v oKmEZzMBy3CK5SD8egH8VGbbx5axOF2a7wrKUmEBtCEybrOkIpT7UTUK4 Q==; X-IronPort-AV: E=McAfee;i="6600,9927,10860"; a="3454678" X-IronPort-AV: E=Sophos;i="6.03,218,1694761200"; d="scan'208";a="3454678" Received: from orsmga008.jf.intel.com ([10.7.209.65]) by orvoesa101.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 12 Oct 2023 01:16:00 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10860"; a="783599309" X-IronPort-AV: E=Sophos;i="6.03,218,1694761200"; d="scan'208";a="783599309" Received: from maloneyj-mobl.ger.corp.intel.com (HELO localhost.localdomain) ([10.213.239.225]) by orsmga008-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 12 Oct 2023 01:15:58 -0700 From: Tvrtko Ursulin To: igt-dev@lists.freedesktop.org, Intel-gfx@lists.freedesktop.org Date: Thu, 12 Oct 2023 09:15:41 +0100 Message-Id: <20231012081547.852052-4-tvrtko.ursulin@linux.intel.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20231012081547.852052-1-tvrtko.ursulin@linux.intel.com> References: <20231012081547.852052-1-tvrtko.ursulin@linux.intel.com> MIME-Version: 1.0 Subject: [Intel-gfx] [PATCH i-g-t 3/9] tests/i915/drm_fdinfo: Add some memory info tests X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Tvrtko Ursulin Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" From: Tvrtko Ursulin A few basic smoke tests to check per client memory info looks legit. Signed-off-by: Tvrtko Ursulin Reviewed-by: Kamil Konieczny --- tests/intel/drm_fdinfo.c | 217 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 217 insertions(+) diff --git a/tests/intel/drm_fdinfo.c b/tests/intel/drm_fdinfo.c index c4218b0d16e6..3ced658f2faa 100644 --- a/tests/intel/drm_fdinfo.c +++ b/tests/intel/drm_fdinfo.c @@ -23,6 +23,7 @@ */ #include +#include #include "igt.h" #include "igt_core.h" @@ -76,6 +77,16 @@ * * SUBTEST: virtual-idle * + * SUBTEST: memory-info-idle + * + * SUBTEST: memory-info-active + * + * SUBTEST: memory-info-resident + * + * SUBTEST: memory-info-purgeable + * + * SUBTEST: memory-info-shared + * * SUBTEST: context-close-stress */ @@ -143,6 +154,11 @@ static unsigned int measured_usleep(unsigned int usec) #define FLAG_HANG (8) #define TEST_ISOLATION (16) +#define TEST_ACTIVE TEST_BUSY +#define TEST_RESIDENT (32) +#define TEST_PURGEABLE (64) +#define TEST_SHARED (128) + static void end_spin(int fd, igt_spin_t *spin, unsigned int flags) { if (!spin) @@ -772,6 +788,172 @@ static void stress_context_close(int i915) igt_stop_helper(&reader); } +static size_t read_fdinfo(char *buf, const size_t sz, int at, const char *name) +{ + size_t count; + int fd; + + fd = openat(at, name, O_RDONLY); + if (fd < 0) + return 0; + + count = read(fd, buf, sz - 1); + if (count > 0) + buf[count - 1] = 0; + close(fd); + + return count > 0 ? count : 0; +} + +/* + * At least this much, but maybe less if we started with a driver internal + * baseline which can go away behind our back. + */ +#define fdinfo_assert_gte(cur, prev, sz, base) \ +({ \ + int64_t __sz = (sz) - (base); \ + int64_t __d = (cur) - (prev); \ + igt_assert_f(__d >= __sz, \ + "prev=%"PRIu64" cur=%"PRIu64" delta=%"PRId64" sz=%"PRIu64" baseline=%"PRIu64"\n%s\n", \ + (prev), (cur), __d, (sz), (base), fdinfo_buf); \ +}) + +#define fdinfo_assert_eq(cur, prev, sz, base) \ +({ \ + int64_t __d = (cur) - (prev); \ + igt_assert_f(__d == 0, \ + "prev=%"PRIu64" cur=%"PRIu64" delta=%"PRId64" sz=%"PRIu64" baseline=%"PRIu64"\n%s\n", \ + (prev), (cur), __d, (sz), (base), fdinfo_buf); \ +}) + +static void +test_memory(int i915, struct gem_memory_region *mr, unsigned int flags) +{ + const unsigned int r = mr->ci.memory_class == I915_MEMORY_CLASS_SYSTEM ? 0 : 1; /* See region map */ + const uint64_t max_mem = 512ull * 1024 * 1024; + const uint64_t max_bo = 16ull * 1024 * 1024; + struct drm_client_fdinfo base_info, prev_info = { }; + struct drm_client_fdinfo info = { }; + char buf[64], fdinfo_buf[4096]; + igt_spin_t *spin = NULL; + uint64_t total = 0, sz; + uint64_t ahnd; + int ret, dir; + + i915 = drm_reopen_driver(i915); + + ahnd = get_reloc_ahnd(i915, 0); + + ret = snprintf(buf, sizeof(buf), "%u", i915); + igt_assert(ret > 0 && ret < sizeof(buf)); + + dir = open("/proc/self/fdinfo", O_DIRECTORY | O_RDONLY); + igt_assert_fd(dir); + + gem_quiescent_gpu(i915); + ret = __igt_parse_drm_fdinfo(dir, buf, &info, NULL, 0, NULL, 0); + igt_assert(ret > 0); + igt_require(info.num_regions); + memcpy(&prev_info, &info, sizeof(info)); + memcpy(&base_info, &info, sizeof(info)); + + while (total < max_mem) { + static const char *region_map[] = { + "system0", + "local0", + }; + uint32_t bo; + + sz = random() % max_bo; + ret = __gem_create_in_memory_region_list(i915, &bo, &sz, 0, + &mr->ci, 1); + igt_assert_eq(ret, 0); + total += sz; + + if (flags & (TEST_RESIDENT | TEST_PURGEABLE | TEST_ACTIVE)) + spin = igt_spin_new(i915, + .dependency = bo, + .ahnd = ahnd); + else + spin = NULL; + + if (flags & TEST_PURGEABLE) { + gem_madvise(i915, bo, I915_MADV_DONTNEED); + igt_spin_free(i915, spin); + gem_quiescent_gpu(i915); + spin = NULL; + } + + if (flags & TEST_SHARED) { + struct drm_gem_open open_struct; + struct drm_gem_flink flink; + + flink.handle = bo; + ret = ioctl(i915, DRM_IOCTL_GEM_FLINK, &flink); + igt_assert_eq(ret, 0); + + open_struct.name = flink.name; + ret = ioctl(i915, DRM_IOCTL_GEM_OPEN, &open_struct); + igt_assert_eq(ret, 0); + igt_assert(open_struct.handle != 0); + } + + memset(&info, 0, sizeof(info)); + ret = __igt_parse_drm_fdinfo(dir, buf, &info, + NULL, 0, + region_map, ARRAY_SIZE(region_map)); + igt_assert(ret > 0); + igt_assert(info.num_regions); + + read_fdinfo(fdinfo_buf, sizeof(fdinfo_buf), dir, buf); + + /* >= to account for objects out of our control */ + fdinfo_assert_gte(info.region_mem[r].total, + prev_info.region_mem[r].total, + sz, + base_info.region_mem[r].total); + + if (flags & TEST_SHARED) + fdinfo_assert_gte(info.region_mem[r].shared, + prev_info.region_mem[r].shared, + sz, + base_info.region_mem[r].shared); + else + fdinfo_assert_eq(info.region_mem[r].shared, + prev_info.region_mem[r].shared, + sz, + base_info.region_mem[r].shared); + + if (flags & (TEST_RESIDENT | TEST_PURGEABLE | TEST_ACTIVE)) + fdinfo_assert_gte(info.region_mem[r].resident, + (uint64_t)0, /* We can only be sure the current buffer is resident. */ + sz, + (uint64_t)0); + + if (flags & TEST_PURGEABLE) + fdinfo_assert_gte(info.region_mem[r].purgeable, + (uint64_t)0, /* We can only be sure the current buffer is purgeable (subset of resident). */ + sz, + (uint64_t)0); + + if (flags & TEST_ACTIVE) + fdinfo_assert_gte(info.region_mem[r].active, + (uint64_t)0, /* We can only be sure the current buffer is active. */ + sz, + (uint64_t)0); + + memcpy(&prev_info, &info, sizeof(info)); + + if (spin) { + igt_spin_free(i915, spin); + gem_quiescent_gpu(i915); + } + } + + put_ahnd(ahnd); + close(i915); +} + #define test_each_engine(T, i915, ctx, e) \ igt_subtest_with_dynamic(T) for_each_ctx_engine(i915, ctx, e) \ igt_dynamic_f("%s", e->name) @@ -903,6 +1085,41 @@ igt_main test_each_engine("isolation", i915, ctx, e) single(i915, ctx, e, TEST_BUSY | TEST_ISOLATION); + igt_subtest_with_dynamic("memory-info-idle") { + for_each_memory_region(r, i915) { + igt_dynamic_f("%s", r->name) + test_memory(i915, r, 0); + } + } + + igt_subtest_with_dynamic("memory-info-resident") { + for_each_memory_region(r, i915) { + igt_dynamic_f("%s", r->name) + test_memory(i915, r, TEST_RESIDENT); + } + } + + igt_subtest_with_dynamic("memory-info-purgeable") { + for_each_memory_region(r, i915) { + igt_dynamic_f("%s", r->name) + test_memory(i915, r, TEST_PURGEABLE); + } + } + + igt_subtest_with_dynamic("memory-info-active") { + for_each_memory_region(r, i915) { + igt_dynamic_f("%s", r->name) + test_memory(i915, r, TEST_ACTIVE); + } + } + + igt_subtest_with_dynamic("memory-info-shared") { + for_each_memory_region(r, i915) { + igt_dynamic_f("%s", r->name) + test_memory(i915, r, TEST_SHARED); + } + } + igt_subtest_group { int newfd; From patchwork Thu Oct 12 08:15:42 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tvrtko Ursulin X-Patchwork-Id: 13418492 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id CA3DBCDB482 for ; Thu, 12 Oct 2023 08:16:10 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 531B310E454; Thu, 12 Oct 2023 08:16:03 +0000 (UTC) Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.9]) by gabe.freedesktop.org (Postfix) with ESMTPS id 19AEF10E47D; Thu, 12 Oct 2023 08:16:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1697098562; x=1728634562; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=Yt46lnO79fw85Z3m8LKQvMLLP745R4hvjLbFZi57wa0=; b=V06LLESw3eq/KVsVa82+s6wWNLm49H62uwhydXSTzLVBRifPy8T1DDsp 8R3+9qcQWiRwkY9gAg2LpWZk+jtUW3FNIu6/SbZvTthSB8egX7+KipKi9 eNdBAdX6pvC5hPPpkbp0/QzfDqN4X/X0Xm+gPHaAW8JdAUo7TfLeDma8E dI9ERQijW6uMEUadpSZ7QbPfDnRrz9H0LnYiBoJzaKpzOxC0/pWabBdyP YYdv84TBcDxuN2wuLlY6cQ7A3wY+Azdu/BnZzlhf+4dLBXomZn3syffIF vC6GE8ewiyFmOZ+Z1uVXwR/QYYtC2ZC39/vebtYTv7FwKo8EtblynIDpl g==; X-IronPort-AV: E=McAfee;i="6600,9927,10860"; a="3454683" X-IronPort-AV: E=Sophos;i="6.03,218,1694761200"; d="scan'208";a="3454683" Received: from orsmga008.jf.intel.com ([10.7.209.65]) by orvoesa101.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 12 Oct 2023 01:16:02 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10860"; a="783599319" X-IronPort-AV: E=Sophos;i="6.03,218,1694761200"; d="scan'208";a="783599319" Received: from maloneyj-mobl.ger.corp.intel.com (HELO localhost.localdomain) ([10.213.239.225]) by orsmga008-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 12 Oct 2023 01:15:59 -0700 From: Tvrtko Ursulin To: igt-dev@lists.freedesktop.org, Intel-gfx@lists.freedesktop.org Date: Thu, 12 Oct 2023 09:15:42 +0100 Message-Id: <20231012081547.852052-5-tvrtko.ursulin@linux.intel.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20231012081547.852052-1-tvrtko.ursulin@linux.intel.com> References: <20231012081547.852052-1-tvrtko.ursulin@linux.intel.com> MIME-Version: 1.0 Subject: [Intel-gfx] [PATCH i-g-t 4/9] lib/igt_drm_fdinfo: Copy over region map name on match X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Tvrtko Ursulin Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" From: Tvrtko Ursulin I will need some record of which regions were found for intel_gpu_top so lets just copy over the region name from the map on the first match. Signed-off-by: Tvrtko Ursulin Reviewed-by: Kamil Konieczny --- lib/igt_drm_fdinfo.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lib/igt_drm_fdinfo.c b/lib/igt_drm_fdinfo.c index b72822894782..222ccbfb1fd6 100644 --- a/lib/igt_drm_fdinfo.c +++ b/lib/igt_drm_fdinfo.c @@ -148,6 +148,10 @@ static int parse_region(char *line, struct drm_client_fdinfo *info, for (i = 0; i < region_entries; i++) { if (!strncmp(name, region_map[i], name_len)) { found = i; + if (!info->region_names[info->num_regions][0]) { + assert(name_len < sizeof(info->region_names[i])); + strncpy(info->region_names[i], name, name_len); + } break; } } From patchwork Thu Oct 12 08:15:43 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tvrtko Ursulin X-Patchwork-Id: 13418493 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 94D9DCDB46E for ; Thu, 12 Oct 2023 08:16:14 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 0E04D10E443; Thu, 12 Oct 2023 08:16:11 +0000 (UTC) Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.9]) by gabe.freedesktop.org (Postfix) with ESMTPS id 79F2210E454; Thu, 12 Oct 2023 08:16:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1697098563; x=1728634563; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=qDZzYgf08JTqeJ9QZ3q4sZVtq17ZzT6I+kUaImgnM3M=; b=g+SU+LBWN8B7exrJyBMDdSKUZQvl/HxyeOAilaCT2lNJNQOHwqEy9m7c TGwTQhu6y8bzFcNVNblD8QePTtvNOfuY2hqvMj7yUypF/STD1UHZMqLaf 2sVrf3vo5VYsPAclQjDn25qwQ4o6bVRl1LmNPsAmMWO3Kx28m0J7DpaY0 NK4TAKisM5q08AfsEMzhMqrtbqJR4XH7z7a8Yj+hP6DbcpeWW96sYAwz4 EnTrT/jMlqNtMt4VMOJoDAQird66fT1pE+PAsyl9CO/AGVpcbVMQ5Foo3 q10Qcusc3/GYV+xzesogaEfvZCXu12HaAz2tMhfYdwV80iW1KghmRq79r A==; X-IronPort-AV: E=McAfee;i="6600,9927,10860"; a="3454685" X-IronPort-AV: E=Sophos;i="6.03,218,1694761200"; d="scan'208";a="3454685" Received: from orsmga008.jf.intel.com ([10.7.209.65]) by orvoesa101.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 12 Oct 2023 01:16:03 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10860"; a="783599338" X-IronPort-AV: E=Sophos;i="6.03,218,1694761200"; d="scan'208";a="783599338" Received: from maloneyj-mobl.ger.corp.intel.com (HELO localhost.localdomain) ([10.213.239.225]) by orsmga008-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 12 Oct 2023 01:16:01 -0700 From: Tvrtko Ursulin To: igt-dev@lists.freedesktop.org, Intel-gfx@lists.freedesktop.org Date: Thu, 12 Oct 2023 09:15:43 +0100 Message-Id: <20231012081547.852052-6-tvrtko.ursulin@linux.intel.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20231012081547.852052-1-tvrtko.ursulin@linux.intel.com> References: <20231012081547.852052-1-tvrtko.ursulin@linux.intel.com> MIME-Version: 1.0 Subject: [Intel-gfx] [PATCH i-g-t 5/9] lib/igt_drm_clients: Fix client id type confusion X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Tvrtko Ursulin Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" From: Tvrtko Ursulin Igt_drm_fdinfo defines it as an unsigned long so it is best that it matches here as well. Signed-off-by: Tvrtko Ursulin Reviewed-by: Kamil Konieczny --- lib/igt_drm_clients.c | 2 +- lib/igt_drm_clients.h | 2 +- tools/intel_gpu_top.c | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/igt_drm_clients.c b/lib/igt_drm_clients.c index 47ad137d5f1f..da51d7335b2b 100644 --- a/lib/igt_drm_clients.c +++ b/lib/igt_drm_clients.c @@ -49,7 +49,7 @@ struct igt_drm_clients *igt_drm_clients_init(void *private_data) static struct igt_drm_client * igt_drm_clients_find(struct igt_drm_clients *clients, enum igt_drm_client_status status, - unsigned int drm_minor, unsigned int id) + unsigned int drm_minor, unsigned long id) { unsigned int start, num; struct igt_drm_client *c; diff --git a/lib/igt_drm_clients.h b/lib/igt_drm_clients.h index 07bd236d43bf..cd37f8508b20 100644 --- a/lib/igt_drm_clients.h +++ b/lib/igt_drm_clients.h @@ -56,7 +56,7 @@ struct igt_drm_client { enum igt_drm_client_status status; struct igt_drm_client_regions *regions; /* Memory regions present in this client, to map with memory usage. */ struct igt_drm_client_engines *engines; /* Engines used by this client, to map with busynees data. */ - unsigned int id; /* DRM client id from fdinfo. */ + unsigned long id; /* DRM client id from fdinfo. */ unsigned int drm_minor; /* DRM minor of this client. */ unsigned int pid; /* PID which has this DRM fd open. */ char pid_str[10]; /* Cached PID representation. */ diff --git a/tools/intel_gpu_top.c b/tools/intel_gpu_top.c index 00506c63db4e..34fa99235e11 100644 --- a/tools/intel_gpu_top.c +++ b/tools/intel_gpu_top.c @@ -2106,7 +2106,7 @@ print_client(struct igt_drm_client *c, struct engines *engines, double t, int li } else if (output_mode == JSON) { char buf[64]; - snprintf(buf, sizeof(buf), "%u", c->id); + snprintf(buf, sizeof(buf), "%lu", c->id); pops->open_struct(buf); __json_add_member("name", c->print_name); From patchwork Thu Oct 12 08:15:44 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tvrtko Ursulin X-Patchwork-Id: 13418496 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 250D3CDB46E for ; Thu, 12 Oct 2023 08:16:18 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id B7C2E10E45D; Thu, 12 Oct 2023 08:16:11 +0000 (UTC) Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.9]) by gabe.freedesktop.org (Postfix) with ESMTPS id B5C3210E459; Thu, 12 Oct 2023 08:16:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1697098564; x=1728634564; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=nvwxwG4c/KiRwfpYmE9F7CnpOmiMqL79bbJPHVrUYWk=; b=HIrC5cv6dc2SEJENnghdKUKaYsm6VBmmEUkAJlsxPDZymLlTG/86ClCI 5jrmxW/rhgL2aiMvnwOhs32kfanWpbsVxfvI8PhgxGTFotsxxetD3PBfz GJgd5F8RCB96sdgmHEF6EPTh0oOlbImNC99Zk0PAlstGVrDQ+L8w1zXy5 MYP+/FRqjuZt+NY2dK0AF62tgzi687wODX7yj8KImsAP4KE20txtPLj1z WrBxSYXMSiNriY9gAbsiPrsaW7PmD+njg0fPWIWwbFCDx2uq7OlIjq5ry R8ZDfHcOzf2yS3K2hCh3HlOFX3q5Q3Z4j5Sj3U05ouKW79KoGAUYCAW2h g==; X-IronPort-AV: E=McAfee;i="6600,9927,10860"; a="3454689" X-IronPort-AV: E=Sophos;i="6.03,218,1694761200"; d="scan'208";a="3454689" Received: from orsmga008.jf.intel.com ([10.7.209.65]) by orvoesa101.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 12 Oct 2023 01:16:04 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10860"; a="783599342" X-IronPort-AV: E=Sophos;i="6.03,218,1694761200"; d="scan'208";a="783599342" Received: from maloneyj-mobl.ger.corp.intel.com (HELO localhost.localdomain) ([10.213.239.225]) by orsmga008-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 12 Oct 2023 01:16:02 -0700 From: Tvrtko Ursulin To: igt-dev@lists.freedesktop.org, Intel-gfx@lists.freedesktop.org Date: Thu, 12 Oct 2023 09:15:44 +0100 Message-Id: <20231012081547.852052-7-tvrtko.ursulin@linux.intel.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20231012081547.852052-1-tvrtko.ursulin@linux.intel.com> References: <20231012081547.852052-1-tvrtko.ursulin@linux.intel.com> MIME-Version: 1.0 Subject: [Intel-gfx] [PATCH i-g-t 6/9] lib/igt_drm_clients: Allow passing in the memory region map X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Tvrtko Ursulin Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" From: Tvrtko Ursulin Same concept as with the engine map, allowing callers to pass in fixed map of names to indices, simplifying their implementation and avoiding auto-detection while parsing. Signed-off-by: Tvrtko Ursulin Reviewed-by: Kamil Konieczny --- lib/igt_drm_clients.c | 5 +++-- lib/igt_drm_clients.h | 3 ++- tools/gputop.c | 4 ++-- tools/intel_gpu_top.c | 8 +++++--- 4 files changed, 12 insertions(+), 8 deletions(-) diff --git a/lib/igt_drm_clients.c b/lib/igt_drm_clients.c index da51d7335b2b..025d60c51503 100644 --- a/lib/igt_drm_clients.c +++ b/lib/igt_drm_clients.c @@ -445,7 +445,8 @@ struct igt_drm_clients * igt_drm_clients_scan(struct igt_drm_clients *clients, bool (*filter_client)(const struct igt_drm_clients *, const struct drm_client_fdinfo *), - const char **name_map, unsigned int map_entries) + const char **name_map, unsigned int map_entries, + const char **region_map, unsigned int region_entries) { struct dirent *proc_dent; struct igt_drm_client *c; @@ -524,7 +525,7 @@ igt_drm_clients_scan(struct igt_drm_clients *clients, if (!__igt_parse_drm_fdinfo(dirfd(fdinfo_dir), fdinfo_dent->d_name, &info, name_map, map_entries, - NULL, 0)) + region_map, region_entries)) continue; if (filter_client && !filter_client(clients, &info)) diff --git a/lib/igt_drm_clients.h b/lib/igt_drm_clients.h index cd37f8508b20..52888aedc25a 100644 --- a/lib/igt_drm_clients.h +++ b/lib/igt_drm_clients.h @@ -93,7 +93,8 @@ struct igt_drm_clients * igt_drm_clients_scan(struct igt_drm_clients *clients, bool (*filter_client)(const struct igt_drm_clients *, const struct drm_client_fdinfo *), - const char **name_map, unsigned int map_entries); + const char **name_map, unsigned int map_entries, + const char **region_map, unsigned int region_entries); struct igt_drm_clients * igt_drm_clients_sort(struct igt_drm_clients *clients, diff --git a/tools/gputop.c b/tools/gputop.c index ea95e0333dd2..71e28f43ee4c 100644 --- a/tools/gputop.c +++ b/tools/gputop.c @@ -253,7 +253,7 @@ int main(int argc, char **argv) if (!clients) exit(1); - igt_drm_clients_scan(clients, NULL, NULL, 0); + igt_drm_clients_scan(clients, NULL, NULL, 0, NULL, 0); for (;;) { struct igt_drm_client *c, *prevc = NULL; @@ -270,7 +270,7 @@ int main(int argc, char **argv) } } - igt_drm_clients_scan(clients, NULL, NULL, 0); + igt_drm_clients_scan(clients, NULL, NULL, 0, NULL, 0); igt_drm_clients_sort(clients, client_cmp); printf("\033[H\033[J"); diff --git a/tools/intel_gpu_top.c b/tools/intel_gpu_top.c index 34fa99235e11..091fe28068dc 100644 --- a/tools/intel_gpu_top.c +++ b/tools/intel_gpu_top.c @@ -2619,8 +2619,9 @@ int main(int argc, char **argv) } pmu_sample(engines); - igt_drm_clients_scan(clients, client_match, engine_map, - ARRAY_SIZE(engine_map)); + igt_drm_clients_scan(clients, client_match, + engine_map, ARRAY_SIZE(engine_map), + NULL, 0); gettime(&ts); if (output_mode == JSON) @@ -2655,7 +2656,8 @@ int main(int argc, char **argv) display_clients(igt_drm_clients_scan(clients, client_match, engine_map, - ARRAY_SIZE(engine_map))); + ARRAY_SIZE(engine_map), + NULL, 0)); scan_us = elapsed_us(&ts, period_us); if (stop_top) From patchwork Thu Oct 12 08:15:45 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tvrtko Ursulin X-Patchwork-Id: 13418494 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id BC76ACDB47E for ; Thu, 12 Oct 2023 08:16:15 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 0E57210E456; Thu, 12 Oct 2023 08:16:11 +0000 (UTC) Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.9]) by gabe.freedesktop.org (Postfix) with ESMTPS id 1076310E443; Thu, 12 Oct 2023 08:16:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1697098566; x=1728634566; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=udGJs6oNm3lXfAiELSmjJpfFL4Tn6/gjdDWtw7dc1Yc=; b=m14YMTMSb4U+UUMeYb2/RtTD/e+DvnG7YGeHNh7w0qs3xrh7DT3YRa8y djc2BxVmQYnzro7MjcWuMKTcOC/HDHaaGzkRVbe1ZmoDVlAsc7T4ciiIk x7KjHrglt35k8//wqXnZBLLXM3f0QqOg09Wn6tWbBnWlQLivYNa2BcmM8 alB9ynfaeFrsceV+E6TMQ+EBUpaUwAbYw6zrB37fjx5rCt3ZLICyNnGhM Dn+mB/f2c9t+oCASaui4XZoCUFAnOXtxh7ezVFucHwTbDjiMtiarS5SzV yJJLzNx4PwUmuAkEICt8lQVYM6bjQNC6iZ1DLy03JTYX5R5fr5iEdhKZq Q==; X-IronPort-AV: E=McAfee;i="6600,9927,10860"; a="3454693" X-IronPort-AV: E=Sophos;i="6.03,218,1694761200"; d="scan'208";a="3454693" Received: from orsmga008.jf.intel.com ([10.7.209.65]) by orvoesa101.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 12 Oct 2023 01:16:05 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10860"; a="783599350" X-IronPort-AV: E=Sophos;i="6.03,218,1694761200"; d="scan'208";a="783599350" Received: from maloneyj-mobl.ger.corp.intel.com (HELO localhost.localdomain) ([10.213.239.225]) by orsmga008-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 12 Oct 2023 01:16:03 -0700 From: Tvrtko Ursulin To: igt-dev@lists.freedesktop.org, Intel-gfx@lists.freedesktop.org Date: Thu, 12 Oct 2023 09:15:45 +0100 Message-Id: <20231012081547.852052-8-tvrtko.ursulin@linux.intel.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20231012081547.852052-1-tvrtko.ursulin@linux.intel.com> References: <20231012081547.852052-1-tvrtko.ursulin@linux.intel.com> MIME-Version: 1.0 Subject: [Intel-gfx] [PATCH i-g-t 7/9] tools/intel_gpu_top: Fully wrap clients operations X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Tvrtko Ursulin Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" From: Tvrtko Ursulin Wrap all operations on clients via the Intel specific wrappers in order to simplify upcoming work. Signed-off-by: Tvrtko Ursulin Reviewed-by: Kamil Konieczny --- tools/intel_gpu_top.c | 42 ++++++++++++++++++++++-------------------- 1 file changed, 22 insertions(+), 20 deletions(-) diff --git a/tools/intel_gpu_top.c b/tools/intel_gpu_top.c index 091fe28068dc..b2e81d5f9ffb 100644 --- a/tools/intel_gpu_top.c +++ b/tools/intel_gpu_top.c @@ -132,6 +132,7 @@ struct engines { struct intel_clients { const char *pci_slot; struct igt_drm_client_engines classes; + struct igt_drm_clients *clients; }; static struct termios termios_orig; @@ -2436,19 +2437,22 @@ intel_init_clients(struct intel_clients *iclients, iclients->classes.capacity[i] = engines->class[i].num_engines; iclients->classes.names[i] = strdup(engines->class[i].name); } + + iclients->clients = igt_drm_clients_init(iclients); } static void intel_free_clients(struct intel_clients *iclients) { + if (iclients->clients) + igt_drm_clients_free(iclients->clients); + free((void *)iclients->pci_slot); free(iclients->classes.capacity); free(iclients->classes.names); } -int main(int argc, char **argv) +static void intel_scan_clients(struct intel_clients *iclients) { - unsigned int period_us = DEFAULT_PERIOD_MS * 1000; - struct igt_drm_clients *clients = NULL; static const char *engine_map[] = { "render", "copy", @@ -2456,6 +2460,15 @@ int main(int argc, char **argv) "video-enhance", "compute", }; + + igt_drm_clients_scan(iclients->clients, client_match, + engine_map, ARRAY_SIZE(engine_map), + NULL, 0); +} + +int main(int argc, char **argv) +{ + unsigned int period_us = DEFAULT_PERIOD_MS * 1000; bool physical_engines = false; struct intel_clients iclients; int con_w = -1, con_h = -1; @@ -2613,15 +2626,11 @@ int main(int argc, char **argv) init_engine_classes(engines); - if (has_drm_fdinfo(&card)) { + if (has_drm_fdinfo(&card)) intel_init_clients(&iclients, &card, engines); - clients = igt_drm_clients_init(&iclients); - } pmu_sample(engines); - igt_drm_clients_scan(clients, client_match, - engine_map, ARRAY_SIZE(engine_map), - NULL, 0); + intel_scan_clients(&iclients); gettime(&ts); if (output_mode == JSON) @@ -2652,12 +2661,8 @@ int main(int argc, char **argv) pmu_sample(engines); t = (double)(engines->ts.cur - engines->ts.prev) / 1e9; - disp_clients = - display_clients(igt_drm_clients_scan(clients, - client_match, - engine_map, - ARRAY_SIZE(engine_map), - NULL, 0)); + intel_scan_clients(&iclients); + disp_clients = display_clients(iclients.clients); scan_us = elapsed_us(&ts, period_us); if (stop_top) @@ -2708,7 +2713,7 @@ int main(int argc, char **argv) pops->close_struct(); } - if (disp_clients != clients) + if (disp_clients != iclients.clients) free_display_clients(disp_clients); if (stop_top) @@ -2723,10 +2728,7 @@ int main(int argc, char **argv) if (output_mode == JSON) printf("]\n"); - if (clients) { - igt_drm_clients_free(clients); - intel_free_clients(&iclients); - } + intel_free_clients(&iclients); free(codename); err_pmu: From patchwork Thu Oct 12 08:15:46 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tvrtko Ursulin X-Patchwork-Id: 13418495 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 0F6F7CDB483 for ; Thu, 12 Oct 2023 08:16:17 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 6ADF810E45B; Thu, 12 Oct 2023 08:16:11 +0000 (UTC) Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.9]) by gabe.freedesktop.org (Postfix) with ESMTPS id 949BA10E44B; Thu, 12 Oct 2023 08:16:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1697098567; x=1728634567; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=a6U4H2lQs0PaPDdLeVrmcAvYvW1I7Z4rxJiMO/qErSo=; b=kChG5Wp6kSk8a1V5+6FcVwsjXH3FhTsXGJOpEt39hZcElTOLcbLYosjy wf97ni5gpUR2MG4JmWQo19L2nXsMtS0KFNCqMyGoRUDndzedC0XT0kqw8 nAF1q8f3fnfumSRyQY5vz1h86QhnES5neT6KipxqtujiTSItgbiVW2GsI NlcALsNCzbCfraA7BCzomcschfFNCfIJiW+1vWRyw10VJvdFXsNQJdkRW vMsczuC3HaDQn+eL8BzZxWHz0hWoTsLmYDy+cutf9qvnuN86L+B7eU4ev 0hBXVyWH69sMID2DJ53/1XwfXHHYFWnvCaojims2tRBPcyk5aADhfpDYL g==; X-IronPort-AV: E=McAfee;i="6600,9927,10860"; a="3454697" X-IronPort-AV: E=Sophos;i="6.03,218,1694761200"; d="scan'208";a="3454697" Received: from orsmga008.jf.intel.com ([10.7.209.65]) by orvoesa101.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 12 Oct 2023 01:16:07 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10860"; a="783599359" X-IronPort-AV: E=Sophos;i="6.03,218,1694761200"; d="scan'208";a="783599359" Received: from maloneyj-mobl.ger.corp.intel.com (HELO localhost.localdomain) ([10.213.239.225]) by orsmga008-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 12 Oct 2023 01:16:05 -0700 From: Tvrtko Ursulin To: igt-dev@lists.freedesktop.org, Intel-gfx@lists.freedesktop.org Date: Thu, 12 Oct 2023 09:15:46 +0100 Message-Id: <20231012081547.852052-9-tvrtko.ursulin@linux.intel.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20231012081547.852052-1-tvrtko.ursulin@linux.intel.com> References: <20231012081547.852052-1-tvrtko.ursulin@linux.intel.com> MIME-Version: 1.0 Subject: [Intel-gfx] [PATCH i-g-t 8/9] tools/intel_gpu_top: Add per client memory info X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Tvrtko Ursulin Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" From: Tvrtko Ursulin JSON output has the full breakdown but for now the interactive mode only shows total and resident aggregated for all memory regions. Signed-off-by: Tvrtko Ursulin Reviewed-by: Kamil Konieczny --- tools/intel_gpu_top.c | 114 +++++++++++++++++++++++++++++++++++++++++- 1 file changed, 112 insertions(+), 2 deletions(-) diff --git a/tools/intel_gpu_top.c b/tools/intel_gpu_top.c index b2e81d5f9ffb..2c09895c79dd 100644 --- a/tools/intel_gpu_top.c +++ b/tools/intel_gpu_top.c @@ -133,11 +133,24 @@ struct intel_clients { const char *pci_slot; struct igt_drm_client_engines classes; struct igt_drm_clients *clients; + struct igt_drm_client_regions *regions; /* Borrowed from first client */ }; static struct termios termios_orig; static bool class_view; +/* Maps i915 fdinfo names to indices */ +static const char *memory_region_map[] = { + "system0", + "local0", +}; + +/* For JSON, 1:1 with indices above. */ +static const char *json_memory_region_names[] = { + "system", + "local", +}; + __attribute__((format(scanf,3,4))) static int igt_sysfs_scanf(int dir, const char *attr, const char *fmt, ...) { @@ -882,6 +895,9 @@ static struct igt_drm_clients *display_clients(struct igt_drm_clients *clients) ac->val = calloc(c->engines->max_engine_id + 1, sizeof(ac->val[0])); assert(ac->val); + ac->regions = c->regions; + ac->memory = calloc(c->regions->max_region_id + 1, + sizeof(ac->memory[0])); ac->samples = 1; } @@ -896,6 +912,14 @@ static struct igt_drm_clients *display_clients(struct igt_drm_clients *clients) for (i = 0; i <= c->engines->max_engine_id; i++) ac->val[i] += c->val[i]; + + for (i = 0; i <= c->regions->max_region_id; i++) { + ac->memory[i].total += c->memory[i].total; + ac->memory[i].shared += c->memory[i].shared; + ac->memory[i].resident += c->memory[i].resident; + ac->memory[i].purgeable += c->memory[i].purgeable; + ac->memory[i].active += c->memory[i].active; + } } aggregated->num_clients = num; @@ -920,8 +944,10 @@ static void free_display_clients(struct igt_drm_clients *clients) * "display" clients are not proper clients and have un-initialized * or borrowed fields which we don't want the library to try and free. */ - igt_for_each_drm_client(clients, c, tmp) + igt_for_each_drm_client(clients, c, tmp) { free(c->val); + free(c->memory); + } free(clients->client); free(clients); @@ -2016,6 +2042,9 @@ print_clients_header(struct igt_drm_clients *clients, int lines, if (lines++ >= con_h || len >= con_w) return lines; + if (iclients->regions) + len += printf(" MEM RSS "); + if (iclients->classes.num_engines) { unsigned int i; int width; @@ -2059,6 +2088,20 @@ print_clients_header(struct igt_drm_clients *clients, int lines, static bool numeric_clients; static bool filter_idle; +static int print_size(uint64_t sz) +{ + char units[] = { ' ', 'K', 'M', 'G' }; + unsigned int u; + + for (u = 0; u < ARRAY_SIZE(units) - 1; u++) { + if (sz & 1023 || sz < 1024) + break; + sz /= 1024; + } + + return printf("%7"PRIu64"%c ", sz, units[u]); +} + static int print_client(struct igt_drm_client *c, struct engines *engines, double t, int lines, int con_w, int con_h, unsigned int period_us, int *class_w) @@ -2076,6 +2119,18 @@ print_client(struct igt_drm_client *c, struct engines *engines, double t, int li len = printf("%*s ", clients->max_pid_len, c->pid_str); + if (iclients->regions) { + uint64_t sz; + + for (sz = 0, i = 0; i <= c->regions->max_region_id; i++) + sz += c->memory[i].total; + len += print_size(sz); + + for (sz = 0, i = 0; i <= c->regions->max_region_id; i++) + sz += c->memory[i].resident; + len += print_size(sz); + } + for (i = 0; i <= iclients->classes.max_engine_id; i++) { double pct, max; @@ -2115,6 +2170,42 @@ print_client(struct igt_drm_client *c, struct engines *engines, double t, int li snprintf(buf, sizeof(buf), "%u", c->pid); __json_add_member("pid", buf); + if (iclients->regions) { + pops->open_struct("memory"); + + for (i = 0; i < ARRAY_SIZE(json_memory_region_names); + i++) { + if (i > c->regions->max_region_id) + break; + + pops->open_struct(json_memory_region_names[i]); + + snprintf(buf, sizeof(buf), "%" PRIu64, + c->memory[i].total); + __json_add_member("total", buf); + + snprintf(buf, sizeof(buf), "%" PRIu64, + c->memory[i].shared); + __json_add_member("shared", buf); + + snprintf(buf, sizeof(buf), "%" PRIu64, + c->memory[i].resident); + __json_add_member("resident", buf); + + snprintf(buf, sizeof(buf), "%" PRIu64, + c->memory[i].purgeable); + __json_add_member("purgeable", buf); + + snprintf(buf, sizeof(buf), "%" PRIu64, + c->memory[i].active); + __json_add_member("active", buf); + + pops->close_struct(); + } + + pops->close_struct(); + } + if (c->samples > 1) { pops->open_struct("engine-classes"); @@ -2460,10 +2551,29 @@ static void intel_scan_clients(struct intel_clients *iclients) "video-enhance", "compute", }; + struct igt_drm_client *c; + unsigned int i; igt_drm_clients_scan(iclients->clients, client_match, engine_map, ARRAY_SIZE(engine_map), - NULL, 0); + memory_region_map, ARRAY_SIZE(memory_region_map)); + + iclients->regions = NULL; + + if (!iclients->clients) + return; + + /* + * Borrow memory region data from first client so we can use it + * when displaying stuff. All regions are the same due our client_match. + */ + igt_for_each_drm_client(iclients->clients, c, i) { + if (c->status == IGT_DRM_CLIENT_ALIVE) { + if (c->regions->num_regions) + iclients->regions = c->regions; + break; + } + } } int main(int argc, char **argv) From patchwork Thu Oct 12 08:15:47 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tvrtko Ursulin X-Patchwork-Id: 13418497 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 6BE93CDB482 for ; Thu, 12 Oct 2023 08:16:19 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id C062910E465; Thu, 12 Oct 2023 08:16:13 +0000 (UTC) Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.9]) by gabe.freedesktop.org (Postfix) with ESMTPS id E2C1410E456; Thu, 12 Oct 2023 08:16:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1697098568; x=1728634568; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=1a01LX+awVkb7xdrdEp8KL4FY9nTvb+uIwHUQl7F+ng=; b=iObsrTd9j1fhqCuJQdHW5Z4JO/JghAfIQ7OL/hCK4OCgrXIIOWOMVI8q fRC6s2X86tnWCPnLc+rnWOFUbPNX0KJ0ZE1yg6ST4bIJxcjAAM3cQPNUW NHQlLLZ31o4yKZTq1bRfjbM0G0M8x0Hf29wT01vl/EW80uL0JWtb+P5bU da14rx1IvXzzCr1b16hO2XLXTICagk0dwW6J+QY0ntWBidD+EVqd4J+EI Fv1saTpHNW7GjeC3LI7DmvmwOgiGo+0NjzVZNnzEht6kiIS3Thlg7B8k3 90BH3jqEmLJeMTpMcSvqda2t9jg/ISYahF6+nRzP2H2fkAu5HFnKw2Osv Q==; X-IronPort-AV: E=McAfee;i="6600,9927,10860"; a="3454698" X-IronPort-AV: E=Sophos;i="6.03,218,1694761200"; d="scan'208";a="3454698" Received: from orsmga008.jf.intel.com ([10.7.209.65]) by orvoesa101.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 12 Oct 2023 01:16:08 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10860"; a="783599362" X-IronPort-AV: E=Sophos;i="6.03,218,1694761200"; d="scan'208";a="783599362" Received: from maloneyj-mobl.ger.corp.intel.com (HELO localhost.localdomain) ([10.213.239.225]) by orsmga008-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 12 Oct 2023 01:16:06 -0700 From: Tvrtko Ursulin To: igt-dev@lists.freedesktop.org, Intel-gfx@lists.freedesktop.org Date: Thu, 12 Oct 2023 09:15:47 +0100 Message-Id: <20231012081547.852052-10-tvrtko.ursulin@linux.intel.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20231012081547.852052-1-tvrtko.ursulin@linux.intel.com> References: <20231012081547.852052-1-tvrtko.ursulin@linux.intel.com> MIME-Version: 1.0 Subject: [Intel-gfx] [PATCH i-g-t 9/9] tools/intel_gpu_top: Add ability to show memory region breakdown X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Tvrtko Ursulin Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" From: Tvrtko Ursulin Similar as we can toggle between aggregated engines and clients, add the capability to toggle between aggregated and per memory region stats. It starts in aggregated mode by default and interactive command 'm' and command line switch '-m' can be used to toggle that. Both only affect the interactive view, while JSON output always contains separate memory regions. Signed-off-by: Tvrtko Ursulin Reviewed-by: Kamil Konieczny --- man/intel_gpu_top.rst | 4 ++++ tools/intel_gpu_top.c | 55 ++++++++++++++++++++++++++++++++++--------- 2 files changed, 48 insertions(+), 11 deletions(-) diff --git a/man/intel_gpu_top.rst b/man/intel_gpu_top.rst index 9499f87f1b4d..44a54a5f219d 100644 --- a/man/intel_gpu_top.rst +++ b/man/intel_gpu_top.rst @@ -55,6 +55,9 @@ OPTIONS -p Default to showing physical engines instead of aggregated classes. +-m + Default to showing all memory regions separately. + RUNTIME CONTROL =============== @@ -68,6 +71,7 @@ Supported keys: | 's' Toggle between sort modes (runtime, total runtime, pid, client id). | 'i' Toggle display of clients which used no GPU time. | 'H' Toggle between per PID aggregation and individual clients. +| 'm' Toggle between aggregated memory regions and full breakdown. DEVICE SELECTION ================ diff --git a/tools/intel_gpu_top.c b/tools/intel_gpu_top.c index 2c09895c79dd..046ead15a122 100644 --- a/tools/intel_gpu_top.c +++ b/tools/intel_gpu_top.c @@ -138,6 +138,7 @@ struct intel_clients { static struct termios termios_orig; static bool class_view; +static bool aggregate_regions; /* Maps i915 fdinfo names to indices */ static const char *memory_region_map[] = { @@ -1050,6 +1051,7 @@ usage(const char *appname) "\t[-L] List all cards.\n" "\t[-d ] Device filter, please check manual page for more details.\n" "\t[-p] Default to showing physical engines instead of classes.\n" + "\t[-m] Default to showing all memory regions.\n" "\n", appname, DEFAULT_PERIOD_MS); igt_device_print_filter_types(); @@ -2032,6 +2034,7 @@ print_clients_header(struct igt_drm_clients *clients, int lines, if (output_mode == INTERACTIVE) { int len, num_active = 0; + unsigned int i; if (lines++ >= con_h) return lines; @@ -2042,11 +2045,17 @@ print_clients_header(struct igt_drm_clients *clients, int lines, if (lines++ >= con_h || len >= con_w) return lines; - if (iclients->regions) - len += printf(" MEM RSS "); + if (iclients->regions) { + if (aggregate_regions) { + len += printf(" MEM RSS "); + } else { + len += printf(" RAM RSS "); + if (iclients->regions->num_regions > 1) + len += printf(" VRAM VRSS "); + } + } if (iclients->classes.num_engines) { - unsigned int i; int width; for (i = 0; i <= iclients->classes.max_engine_id; i++) { @@ -2120,15 +2129,26 @@ print_client(struct igt_drm_client *c, struct engines *engines, double t, int li len = printf("%*s ", clients->max_pid_len, c->pid_str); if (iclients->regions) { - uint64_t sz; + if (aggregate_regions) { + uint64_t sz; - for (sz = 0, i = 0; i <= c->regions->max_region_id; i++) - sz += c->memory[i].total; - len += print_size(sz); + for (sz = 0, i = 0; + i <= c->regions->max_region_id; i++) + sz += c->memory[i].total; + len += print_size(sz); - for (sz = 0, i = 0; i <= c->regions->max_region_id; i++) - sz += c->memory[i].resident; - len += print_size(sz); + for (sz = 0, i = 0; + i <= c->regions->max_region_id; i++) + sz += c->memory[i].resident; + len += print_size(sz); + } else { + len += print_size(c->memory[0].total); + len += print_size(c->memory[0].resident); + if (c->regions->num_regions > 1) { + len += print_size(c->memory[1].total); + len += print_size(c->memory[1].resident); + } + } } for (i = 0; i <= iclients->classes.max_engine_id; i++) { @@ -2405,6 +2425,13 @@ static void process_normal_stdin(void) else header_msg = "Showing individual clients."; break; + case 'm': + aggregate_regions ^= true; + if (aggregate_regions) + header_msg = "Aggregating memory regions."; + else + header_msg = "Showing memory regions."; + break; }; } } @@ -2453,6 +2480,7 @@ static void show_help_screen(void) " 's' Toggle between sort modes (runtime, total runtime, pid, client id).\n" " 'i' Toggle display of clients which used no GPU time.\n" " 'H' Toggle between per PID aggregation and individual clients.\n" +" 'm' Toggle between aggregated memory regions and full breakdown.\n" "\n" " 'h' or 'q' Exit interactive help.\n" "\n"); @@ -2580,6 +2608,7 @@ int main(int argc, char **argv) { unsigned int period_us = DEFAULT_PERIOD_MS * 1000; bool physical_engines = false; + bool separate_regions = false; struct intel_clients iclients; int con_w = -1, con_h = -1; char *output_path = NULL; @@ -2592,7 +2621,7 @@ int main(int argc, char **argv) struct timespec ts; /* Parse options */ - while ((ch = getopt(argc, argv, "o:s:d:pcJLlh")) != -1) { + while ((ch = getopt(argc, argv, "o:s:d:mpcJLlh")) != -1) { switch (ch) { case 'o': output_path = optarg; @@ -2606,6 +2635,9 @@ int main(int argc, char **argv) case 'p': physical_engines = true; break; + case 'm': + separate_regions = true; + break; case 'c': output_mode = CSV; break; @@ -2649,6 +2681,7 @@ int main(int argc, char **argv) fprintf(stderr, "Failed to install signal handler!\n"); class_view = !physical_engines; + aggregate_regions = !separate_regions; switch (output_mode) { case INTERACTIVE: