From: Artem Bityutskiy <dedekind1@gmail.com>
To: Len Brown <lenb@kernel.org>
Cc: Linux PM Mailing List <linux-pm@vger.kernel.org>,
Artem Bityutskiy <dedekind1@gmail.com>
Subject: [PATCH 1/5] tools/power turbostat: add missing print_float_value()
Date: Wed, 11 Mar 2026 11:00:31 +0200 [thread overview]
Message-ID: <20260311090035.169539-2-dedekind1@gmail.com> (raw)
In-Reply-To: <20260311090035.169539-1-dedekind1@gmail.com>
From: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
In the core and package cases, all PMT counter prints use
print_float_value(). But the thread case uses sprintf(), which is not
a bug, but inconsistent. Most probably just an oversight.
Address the inconsistency by using print_float_value() in the thread
case too.
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
---
tools/power/x86/turbostat/turbostat.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/tools/power/x86/turbostat/turbostat.c b/tools/power/x86/turbostat/turbostat.c
index b985bce69142f..9744f9caac9af 100644
--- a/tools/power/x86/turbostat/turbostat.c
+++ b/tools/power/x86/turbostat/turbostat.c
@@ -3489,12 +3489,12 @@ int format_counters(PER_THREAD_PARAMS)
case PMT_TYPE_XTAL_TIME:
value_converted = pct(value_raw / crystal_hz, interval_float);
- outp += sprintf(outp, "%s%.2f", (printed++ ? delim : ""), value_converted);
+ outp += print_float_value(&printed, delim, value_converted);
break;
case PMT_TYPE_TCORE_CLOCK:
value_converted = pct(value_raw / tcore_clock_freq_hz, interval_float);
- outp += sprintf(outp, "%s%.2f", (printed++ ? delim : ""), value_converted);
+ outp += print_float_value(&printed, delim, value_converted);
}
}
--
2.53.0
next prev parent reply other threads:[~2026-03-11 9:00 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-03-11 9:00 [PATCH 0/6] tools/power turbostat: Fixes and cleanups Artem Bityutskiy
2026-03-11 9:00 ` Artem Bityutskiy [this message]
2026-03-18 3:37 ` [PATCH 1/5] tools/power turbostat: add missing print_float_value() Len Brown
2026-03-11 9:00 ` [PATCH 2/5] tools/power turbostat: fix incorrect format variable Artem Bityutskiy
2026-03-18 3:38 ` Len Brown
2026-03-11 9:00 ` [PATCH 3/5] tools/power turbostat: fix --show/--hide for individual cpuidle counters Artem Bityutskiy
2026-03-18 3:38 ` Len Brown
2026-03-11 9:00 ` [PATCH 4/5] tools/power turbostat: fix delimiter bug in print functions Artem Bityutskiy
2026-03-18 3:23 ` Len Brown
2026-03-11 9:00 ` [PATCH 5/5] tools/power turbostat: cleanup print helper functions Artem Bityutskiy
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=20260311090035.169539-2-dedekind1@gmail.com \
--to=dedekind1@gmail.com \
--cc=lenb@kernel.org \
--cc=linux-pm@vger.kernel.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