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 09/12] lib/igt_drm_clients: Store second data for ticks busyness
Date: Fri, 5 Apr 2024 01:00:53 -0500 [thread overview]
Message-ID: <20240405060056.59379-10-lucas.demarchi@intel.com> (raw)
In-Reply-To: <20240405060056.59379-1-lucas.demarchi@intel.com>
When unit is "ticks" store the second counter to be used by tools.
Signed-off-by: Lucas De Marchi <lucas.demarchi@intel.com>
---
lib/igt_drm_clients.c | 22 +++++++++++++++++-----
lib/igt_drm_clients.h | 2 ++
2 files changed, 19 insertions(+), 5 deletions(-)
diff --git a/lib/igt_drm_clients.c b/lib/igt_drm_clients.c
index 40d494441..da966769f 100644
--- a/lib/igt_drm_clients.c
+++ b/lib/igt_drm_clients.c
@@ -108,14 +108,22 @@ igt_drm_client_update(struct igt_drm_client *c, unsigned int pid, char *name,
for (i = 0; i <= c->engines->max_engine_id; i++) {
assert(i < ARRAY_SIZE(info->busy));
-
if (info->busy[i] < c->last[i])
continue; /* It will catch up soon. */
- c->total_runtime += info->busy[i];
- c->val[i] = info->busy[i] - c->last[i];
- c->last_runtime += c->val[i];
- c->last[i] = info->busy[i];
+ if (info->unit[i] == DRM_CLIENT_ENGINE_UNIT_NS) {
+ c->total_runtime += info->busy[i];
+ c->val[i] = info->busy[i] - c->last[i];
+ c->last_runtime += c->val[i];
+ c->last[i] = info->busy[i];
+ } else if (info->unit[i] == DRM_CLIENT_ENGINE_UNIT_TICKS) {
+ c->total_runtime += info->busy2[i];
+ c->val[i] = info->busy[i] - c->last[i];
+ c->val2[i] = info->busy2[i] - c->last2[i];
+ c->last[i] = info->busy[i];
+ c->last2[i] = info->busy2[i];
+ c->last_runtime += c->val2[i];
+ }
}
/* Memory regions */
@@ -184,7 +192,9 @@ igt_drm_client_add(struct igt_drm_clients *clients,
}
c->val = calloc(c->engines->max_engine_id + 1, sizeof(*c->val));
+ 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));
assert(c->val && c->last);
/* Memory regions */
@@ -224,7 +234,9 @@ void igt_drm_client_free(struct igt_drm_client *c, bool clear)
free(c->engines);
free(c->val);
+ free(c->val2);
free(c->last);
+ free(c->last2);
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 52888aedc..cfc53a344 100644
--- a/lib/igt_drm_clients.h
+++ b/lib/igt_drm_clients.h
@@ -66,7 +66,9 @@ struct igt_drm_client {
unsigned long total_runtime; /* Aggregate busyness on all engines since client start. */
unsigned long last_runtime; /* Aggregate busyness on all engines since previous scan. */
unsigned long *val; /* Array of engine busyness data, relative to previous scan. */
+ 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. */
struct drm_client_meminfo *memory; /* Array of region memory utilisation as parsed from fdinfo. */
};
--
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 ` Lucas De Marchi [this message]
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 ` [PATCH i-g-t 12/12] RFC: gputop: Add support for ticks unit Lucas De Marchi
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-10-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