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 98F5FD0D157 for ; Wed, 7 Jan 2026 18:33:29 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 4E69F10E651; Wed, 7 Jan 2026 18:33:29 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (2048-bit key; unprotected) header.d=intel.com header.i=@intel.com header.b="GxDz8KZU"; dkim-atps=neutral Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.17]) by gabe.freedesktop.org (Postfix) with ESMTPS id AB2F210E65C for ; Wed, 7 Jan 2026 18:33:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1767810809; x=1799346809; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=E9yjnZUQrQw+qgSzZADLF9VKOnShHOTw3E4wqP1f0T4=; b=GxDz8KZUmSMx9s6artp4DMM+ePKAqNDF5z8JoSU/Fkzj7QLIxvcxwRAp GXEdtDISyDbdPRP0N4Z7DWFnYSNKW4NlfWZmBlq2CtUIfC9QsS2hMKWUB LB0CHjTz2nL+AMRHLqhnT/b3mVf6xTOHSAY39xuvwGS4wKw7tZ57dzWHK 2RVerfkt7UwFDoB7sR/9UJgts96jDXbHK5ilUqMpUViAKWgKFNLELl+AN XbqlFZ8xRUPY9SEIIePksyJZOQU4BPSz/Mg5f4RuuWg9Qnp+5L/hMSd+M rFFwB6WtKP72wugpl/EcCrjkwwkn5ToGpx16ztF8HoYtiMyLkMuqOGVZH w==; X-CSE-ConnectionGUID: DZXCJvfjS9yAXWJagJFJjg== X-CSE-MsgGUID: a+2ebBOpTl+UPTPpUY1GjQ== X-IronPort-AV: E=McAfee;i="6800,10657,11664"; a="69101078" X-IronPort-AV: E=Sophos;i="6.21,208,1763452800"; d="scan'208";a="69101078" Received: from fmviesa004.fm.intel.com ([10.60.135.144]) by fmvoesa111.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 07 Jan 2026 10:33:28 -0800 X-CSE-ConnectionGUID: xRw1lYYpT/eooXKc3YFrTg== X-CSE-MsgGUID: Iw0nK6bvTzyjSHi14CYnEg== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.21,208,1763452800"; d="scan'208";a="207846218" Received: from psoham-nuc7i7bnh.iind.intel.com ([10.190.216.151]) by fmviesa004-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 07 Jan 2026 10:31:42 -0800 From: Soham Purkait To: igt-dev@lists.freedesktop.org, riana.tauro@intel.com, badal.nilawar@intel.com, kamil.konieczny@intel.com Cc: anshuman.gupta@intel.com, soham.purkait@intel.com, umesh.nerlige.ramappa@intel.com Subject: [PATCH i-g-t v4 6/6] tools/gputop.src/gputop: Add command line option for pci device filter Date: Wed, 7 Jan 2026 23:56:54 +0530 Message-Id: <20260107182654.84173-7-soham.purkait@intel.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20260107182654.84173-1-soham.purkait@intel.com> References: <20260107182654.84173-1-soham.purkait@intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-BeenThere: igt-dev@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Development mailing list for IGT GPU Tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: igt-dev-bounces@lists.freedesktop.org Sender: "igt-dev" With a new command-line option for device filtering, the engine busyness for the specific device could be selected. Signed-off-by: Soham Purkait --- tools/gputop.src/gputop.c | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/tools/gputop.src/gputop.c b/tools/gputop.src/gputop.c index 125cf4358..2087ae67a 100644 --- a/tools/gputop.src/gputop.c +++ b/tools/gputop.src/gputop.c @@ -414,6 +414,7 @@ static void clrscr(void) struct gputop_args { long n_iter; unsigned long delay_usec; + char *device; }; static void countdown(const char *msg, const int start_sec) @@ -452,7 +453,8 @@ static void help(char *full_path) "Options:\n" "\t-h, --help show this help\n" "\t-d, --delay =SEC[.TENTHS] iterative delay as SECS [.TENTHS]\n" - "\t-n, --iterations =NUMBER number of executions\n\n" + "\t-n, --iterations =NUMBER number of executions\n" + "\t-D, --device Device filter\n\n" "Running without root:\n" "\tAs a non-root user, CAP_PERFMON or perf_event_paranoid is required to\n" "\taccess engine busyness\n" @@ -483,11 +485,12 @@ static void help(char *full_path) static int parse_args(int argc, char * const argv[], struct gputop_args *args) { - static const char cmdopts_s[] = "hn:d:"; + static const char cmdopts_s[] = "hn:d:D:"; static const struct option cmdopts[] = { {"help", no_argument, 0, 'h'}, {"delay", required_argument, 0, 'd'}, {"iterations", required_argument, 0, 'n'}, + {"device", required_argument, 0, 'D'}, { } }; @@ -495,6 +498,7 @@ static int parse_args(int argc, char * const argv[], struct gputop_args *args) memset(args, 0, sizeof(*args)); args->n_iter = -1; args->delay_usec = 2 * USEC_PER_SEC; + args->device = NULL; for (;;) { int c, idx = 0; @@ -518,6 +522,9 @@ static int parse_args(int argc, char * const argv[], struct gputop_args *args) return -1; } break; + case 'D': + args->device = optarg; + break; case 'h': help(argv[0]); return 0; @@ -559,7 +566,8 @@ int main(int argc, char **argv) n = args.n_iter; period_us = args.delay_usec; - populate_device_instances("device:subsystem=pci,card=all"); + populate_device_instances(args.device ? args.device + : "device:subsystem=pci,card=all"); for (int i = 0; drivers[i]; i++) { if (!per_driver_contexts[i].device_present) -- 2.34.1