From: Lucas De Marchi <lucas.demarchi@intel.com>
To: igt-dev@lists.freedesktop.org
Cc: Lucas De Marchi <lucas.demarchi@intel.com>
Subject: [PATCH i-g-t 1/2] lib/igt_drm_fdinfo: Use longest match first
Date: Wed, 31 Jan 2024 16:46:24 -0800 [thread overview]
Message-ID: <20240201004744.352041-2-lucas.demarchi@intel.com> (raw)
In-Reply-To: <20240201004744.352041-1-lucas.demarchi@intel.com>
Instead of checking twice the match, just use longest match first.
Signed-off-by: Lucas De Marchi <lucas.demarchi@intel.com>
---
lib/igt_drm_fdinfo.c | 19 +++++++++----------
1 file changed, 9 insertions(+), 10 deletions(-)
diff --git a/lib/igt_drm_fdinfo.c b/lib/igt_drm_fdinfo.c
index 222ccbfb1..5c0ccf624 100644
--- a/lib/igt_drm_fdinfo.c
+++ b/lib/igt_drm_fdinfo.c
@@ -239,8 +239,15 @@ __igt_parse_drm_fdinfo(int dir, const char *fd, struct drm_client_fdinfo *info,
strlen("drm-client-id")))) {
info->id = atol(v);
good++;
- } else if (!strncmp(l, "drm-engine-", 11) &&
- strncmp(l, "drm-engine-capacity-", 20)) {
+ } else if (!strncmp(l, "drm-engine-capacity-", 20)) {
+ idx = parse_engine(l, info,
+ strlen("drm-engine-capacity-"),
+ name_map, map_entries, &val);
+ if (idx >= 0) {
+ info->capacity[idx] = val;
+ num_capacity++;
+ }
+ } else if (!strncmp(l, "drm-engine-", 11)) {
idx = parse_engine(l, info, strlen("drm-engine-"),
name_map, map_entries, &val);
if (idx >= 0) {
@@ -251,14 +258,6 @@ __igt_parse_drm_fdinfo(int dir, const char *fd, struct drm_client_fdinfo *info,
if (idx > info->last_engine_index)
info->last_engine_index = idx;
}
- } else if (!strncmp(l, "drm-engine-capacity-", 20)) {
- idx = parse_engine(l, info,
- strlen("drm-engine-capacity-"),
- name_map, map_entries, &val);
- if (idx >= 0) {
- info->capacity[idx] = val;
- num_capacity++;
- }
} else if (!strncmp(l, "drm-total-", 10)) {
idx = parse_region(l, info, strlen("drm-total-"),
region_map, region_entries, &val);
--
2.43.0
next prev parent reply other threads:[~2024-02-01 0:47 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-02-01 0:46 [PATCH i-g-t 0/2] fdinfo: drive-by changes Lucas De Marchi
2024-02-01 0:46 ` Lucas De Marchi [this message]
2024-02-01 12:43 ` [PATCH i-g-t 1/2] lib/igt_drm_fdinfo: Use longest match first Kamil Konieczny
2024-02-01 14:09 ` Lucas De Marchi
2024-02-07 10:32 ` Tvrtko Ursulin
2024-02-07 17:50 ` Lucas De Marchi
2024-02-07 18:57 ` Tvrtko Ursulin
2024-02-01 0:46 ` [PATCH i-g-t 2/2] lib/igt_drm_fdinfo: Mandatory drm-fields first Lucas De Marchi
2024-02-01 12:45 ` Kamil Konieczny
2024-02-07 10:38 ` Tvrtko Ursulin
2024-02-01 2:22 ` ✓ Fi.CI.BAT: success for fdinfo: drive-by changes Patchwork
2024-02-01 2:44 ` ✓ CI.xeBAT: " Patchwork
2024-02-01 3:48 ` ✗ Fi.CI.IGT: failure " Patchwork
2024-02-01 20:35 ` Lucas De Marchi
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=20240201004744.352041-2-lucas.demarchi@intel.com \
--to=lucas.demarchi@intel.com \
--cc=igt-dev@lists.freedesktop.org \
/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