From: Lucas De Marchi <lucas.demarchi@intel.com>
To: igt-dev@lists.freedesktop.org
Cc: Tvrtko Ursulin <tursulin@ursulin.net>,
Umesh Nerlige Ramappa <umesh.nerlige.ramappa@intel.com>,
Lucas De Marchi <lucas.demarchi@intel.com>
Subject: [PATCH i-g-t 12/12] RFC: gputop: Add support for ticks unit
Date: Fri, 5 Apr 2024 01:00:56 -0500 [thread overview]
Message-ID: <20240405060056.59379-13-lucas.demarchi@intel.com> (raw)
In-Reply-To: <20240405060056.59379-1-lucas.demarchi@intel.com>
Add support for "ticks" that take out the CPU time elapsed from account
and rather uses the GPU timestamp as recorded from fdinfo. The busyness
is calculated as, for each engine class:
u[i+1] - u[i]
pct = -----------------
Gt[i+1] - Gt[i]
where u[i] is the number of GPU ticks used by a client on an engine and
Gt[i] is the GPU timestamp in ticks. Main advantage over previous "ns"
unit type is that there's only one clock domain involved and it's
expected to work better with SR-IOV when each VF gets a certain quanta
of the GPU - that quanta should be reported as 100% GPU utilization,
which would never be achieved if the CPU clock domain was involved.
Signed-off-by: Lucas De Marchi <lucas.demarchi@intel.com>
---
lib/igt_drm_clients.c | 2 ++
lib/igt_drm_clients.h | 1 +
tools/gputop.c | 8 ++++++--
3 files changed, 9 insertions(+), 2 deletions(-)
diff --git a/lib/igt_drm_clients.c b/lib/igt_drm_clients.c
index da966769f..22c56b279 100644
--- a/lib/igt_drm_clients.c
+++ b/lib/igt_drm_clients.c
@@ -195,6 +195,7 @@ igt_drm_client_add(struct igt_drm_clients *clients,
c->val2 = calloc(c->engines->max_engine_id + 1, sizeof(*c->val2));
c->last = calloc(c->engines->max_engine_id + 1, sizeof(*c->last));
c->last2 = calloc(c->engines->max_engine_id + 1, sizeof(*c->last2));
+ c->unit = calloc(c->engines->max_engine_id + 1, sizeof(*c->unit));
assert(c->val && c->last);
/* Memory regions */
@@ -237,6 +238,7 @@ void igt_drm_client_free(struct igt_drm_client *c, bool clear)
free(c->val2);
free(c->last);
free(c->last2);
+ free(c->unit);
if (c->regions) {
for (i = 0; i <= c->regions->max_region_id; i++)
diff --git a/lib/igt_drm_clients.h b/lib/igt_drm_clients.h
index cfc53a344..9c2e96d1e 100644
--- a/lib/igt_drm_clients.h
+++ b/lib/igt_drm_clients.h
@@ -69,6 +69,7 @@ struct igt_drm_client {
unsigned long *val2; /* Array of engine busyness data2, relative to previous scan. */
uint64_t *last; /* Array of engine busyness data as parsed from fdinfo. */
uint64_t *last2; /* Array of engine busyness data2 as parsed from fdinfo. */
+ enum drm_client_engine_unit *unit; /* Array of unit used for engine busyness data. */
struct drm_client_meminfo *memory; /* Array of region memory utilisation as parsed from fdinfo. */
};
diff --git a/tools/gputop.c b/tools/gputop.c
index ea23e1de5..3649bf4d7 100644
--- a/tools/gputop.c
+++ b/tools/gputop.c
@@ -183,8 +183,12 @@ print_client(struct igt_drm_client *c, struct igt_drm_client **prevc,
if (!c->engines->capacity[i])
continue;
- pct = (double)c->val[i] / period_us / 1e3 * 100 /
- c->engines->capacity[i];
+ if (c->unit[i] == DRM_CLIENT_ENGINE_UNIT_NS)
+ pct = (double)c->val[i] / period_us / 1e3 * 100 /
+ c->engines->capacity[i];
+ else if (c->unit[i] == DRM_CLIENT_ENGINE_UNIT_TICKS)
+ pct = (double)(c->val2[i] * 100) / c->val[1] /
+ c->engines->capacity[i];
/*
* Guard against fluctuations between our scanning period and
--
2.44.0
next prev parent reply other threads:[~2024-04-05 6:01 UTC|newest]
Thread overview: 33+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-04-05 6:00 [PATCH i-g-t 00/12] gputop: Add support for xe Lucas De Marchi
2024-04-05 6:00 ` [PATCH i-g-t 01/12] lib/igt_drm_fdinfo: Stop passing key twice Lucas De Marchi
2024-04-18 22:14 ` Umesh Nerlige Ramappa
2024-04-19 7:42 ` Tvrtko Ursulin
2024-04-19 16:35 ` Lucas De Marchi
2024-04-19 18:34 ` Tvrtko Ursulin
2024-04-05 6:00 ` [PATCH i-g-t 02/12] lib/igt_drm_fdinfo: Remove prefix arg from parse functions Lucas De Marchi
2024-04-05 6:00 ` [PATCH i-g-t 03/12] lib/igt_drm_fdinfo: Fix wrong name len assert Lucas De Marchi
2024-04-18 22:25 ` Umesh Nerlige Ramappa
2024-04-19 7:48 ` Tvrtko Ursulin
2024-04-19 7:49 ` Tvrtko Ursulin
2024-04-05 6:00 ` [PATCH i-g-t 04/12] lib/igt_drm_fdinfo: Assert pdev is not truncated Lucas De Marchi
2024-04-18 22:27 ` Umesh Nerlige Ramappa
2024-04-05 6:00 ` [PATCH i-g-t 05/12] lib/igt_drm_fdinfo: Detect invalid drm-client-id Lucas De Marchi
2024-04-18 22:31 ` Umesh Nerlige Ramappa
2024-04-05 6:00 ` [PATCH i-g-t 06/12] lib/igt_drm_fdinfo: Stop ignoring space where not needed Lucas De Marchi
2024-04-18 22:34 ` Umesh Nerlige Ramappa
2024-04-05 6:00 ` [PATCH i-g-t 07/12] lib/igt_drm_fdinfo: Parse unit for engine utilization Lucas De Marchi
2024-04-18 22:48 ` Umesh Nerlige Ramappa
2024-04-19 7:58 ` Tvrtko Ursulin
2024-04-19 16:21 ` Lucas De Marchi
2024-04-19 18:32 ` Tvrtko Ursulin
2024-04-05 6:00 ` [PATCH i-g-t 08/12] lib/igt_drm_fdinfo: Store 2 counters for "ticks" unit Lucas De Marchi
2024-04-05 6:00 ` [PATCH i-g-t 09/12] lib/igt_drm_clients: Store second data for ticks busyness Lucas De Marchi
2024-04-05 6:00 ` [PATCH i-g-t 10/12] gputop: Extract method to update console size Lucas De Marchi
2024-04-18 22:51 ` Umesh Nerlige Ramappa
2024-04-05 6:00 ` [PATCH i-g-t 11/12] gputop: Extract clrscr() Lucas De Marchi
2024-04-18 22:52 ` Umesh Nerlige Ramappa
2024-04-05 6:00 ` Lucas De Marchi [this message]
2024-04-05 8:04 ` ✗ GitLab.Pipeline: warning for gputop: Add support for xe Patchwork
2024-04-05 8:17 ` ✓ CI.xeBAT: success " Patchwork
2024-04-05 8:27 ` ✓ Fi.CI.BAT: " Patchwork
2024-04-05 16:22 ` ✗ Fi.CI.IGT: failure " Patchwork
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20240405060056.59379-13-lucas.demarchi@intel.com \
--to=lucas.demarchi@intel.com \
--cc=igt-dev@lists.freedesktop.org \
--cc=tursulin@ursulin.net \
--cc=umesh.nerlige.ramappa@intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox