Linux Power Management development
 help / color / mirror / Atom feed
From: Yousef Alhouseen <alhouseenyousef@gmail.com>
To: ray.huang@amd.com, mario.limonciello@amd.com, perry.yuan@amd.com
Cc: kprateek.nayak@amd.com, linux-pm@vger.kernel.org,
	linux-kernel@vger.kernel.org,
	Yousef Alhouseen <alhouseenyousef@gmail.com>
Subject: [PATCH] tools/power: amd_pstate_trace: fix help path dependencies
Date: Wed, 24 Jun 2026 14:31:35 +0200	[thread overview]
Message-ID: <20260624123135.7193-1-alhouseenyousef@gmail.com> (raw)

amd_pstate_trace imports Gnuplot and numpy before parsing command-line
options. As a result, even "-h" fails if those optional runtime modules are
not installed.

It also handles "-h" by printing a blank line and exiting. Use the existing
help printer for "-h", and move the numpy import to the path that needs it.
The direct Gnuplot import is unused, so remove it.

Signed-off-by: Yousef Alhouseen <alhouseenyousef@gmail.com>
---
 tools/power/x86/amd_pstate_tracer/amd_pstate_trace.py | 11 +++++------
 1 file changed, 5 insertions(+), 6 deletions(-)

diff --git a/tools/power/x86/amd_pstate_tracer/amd_pstate_trace.py b/tools/power/x86/amd_pstate_tracer/amd_pstate_trace.py
index 875b08655..b1b201b2e 100755
--- a/tools/power/x86/amd_pstate_tracer/amd_pstate_trace.py
+++ b/tools/power/x86/amd_pstate_tracer/amd_pstate_trace.py
@@ -27,8 +27,6 @@ import re
 import signal
 import sys
 import getopt
-import Gnuplot
-from numpy import *
 from decimal import *
 sys.path.append(os.path.join(os.path.dirname(__file__), "..", "intel_pstate_tracer"))
 import intel_pstate_tracer as ipt
@@ -260,9 +258,6 @@ graph_data_present = False;
 valid1 = False
 valid2 = False
 
-cpu_mask = zeros((MAX_CPUS,), dtype=int)
-
-
 try:
     opts, args = getopt.getopt(sys.argv[1:],"ht:i:c:n:m:",["help","trace_file=","interval=","cpu=","name=","memory="])
 except getopt.GetoptError:
@@ -270,7 +265,7 @@ except getopt.GetoptError:
     sys.exit(2)
 for opt, arg in opts:
     if opt == '-h':
-        print()
+        ipt.print_help('amd_pstate')
         sys.exit()
     elif opt in ("-t", "--trace_file"):
         valid1 = True
@@ -291,6 +286,10 @@ if not (valid1 and valid2):
     ipt.print_help('amd_pstate')
     sys.exit()
 
+from numpy import zeros
+
+cpu_mask = zeros((MAX_CPUS,), dtype=int)
+
 if cpu_list:
     for p in re.split("[,]", cpu_list):
         if int(p) < MAX_CPUS :
-- 
2.54.0


             reply	other threads:[~2026-06-24 12:31 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-06-24 12:31 Yousef Alhouseen [this message]
2026-07-22 12:48 ` [PATCH] tools/power: amd_pstate_trace: fix help path dependencies Rafael J. Wysocki (Intel)
2026-07-22 15:21   ` K Prateek Nayak
2026-07-22 15:32     ` Mario Limonciello
2026-07-30 22:08       ` Yousef Alhouseen

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=20260624123135.7193-1-alhouseenyousef@gmail.com \
    --to=alhouseenyousef@gmail.com \
    --cc=kprateek.nayak@amd.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=mario.limonciello@amd.com \
    --cc=perry.yuan@amd.com \
    --cc=ray.huang@amd.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