From: Petr Vorel <pvorel@suse.cz>
To: "Kubaj, Piotr" <piotr.kubaj@intel.com>
Cc: "Wysocki, Rafael J" <rafael.j.wysocki@intel.com>,
"Ossowski, Tomasz" <tomasz.ossowski@intel.com>,
"Dubel, Helena Anna" <helena.anna.dubel@intel.com>,
"Niestepski, Daniel" <daniel.niestepski@intel.com>,
"ltp@lists.linux.it" <ltp@lists.linux.it>
Subject: Re: [LTP] [PATCH v4] thermal: add new test group
Date: Thu, 29 Jan 2026 13:58:40 +0100 [thread overview]
Message-ID: <20260129125840.GA102011@pevik> (raw)
In-Reply-To: <c3447fef150c0ad541c4628b50fc84cf19debb23.camel@intel.com>
Hi Piotr,
...
> > > +static void run(void)
> > > +{
> > > + bool status = 1;
> > > + char line[8192];
> > > + uint64_t interrupt_init[nproc], interrupt_later[nproc];
> > > +
> > > + read_interrupts(interrupt_init, nproc);
> > > +
> > > + DIR *dir = SAFE_OPENDIR("/sys/class/thermal/");
> > > + struct dirent *entry;
> > > + int tz_counter = 0;
> > > +
> > > + while ((entry = SAFE_READDIR(dir))) {
> > > + if ((strncmp(entry->d_name, "thermal_zone",
> > > sizeof("thermal_zone"))) > 0)
> > > + tz_counter++;
> > > + }
> > > + SAFE_CLOSEDIR(dir);
> > > + tst_res(TDEBUG, "Found %d thermal zone(s)", tz_counter);
> > As I noted previously, at least this part will not change if you run
> > test more
> > times, does it? Why not to move it to the setup()?
> > Imagine running test 1000x iterations:
> > ./thermal_interrupt_events -i 1000
> > Why to waste time with reading it again?
> > The only exception might be reading interrupts. I would expect it's
> > ok to have
> > only the initial state (read in the setup() as well), but maybe (when
> > test run
> > with more iterations via -i x) it needs to have the updated state
> > (from the
> > previous iteration).
> That part is still in consultation with our architect.
Thank you! Of course, it's ok to keep it if it's needed.
...
> > > + for (int i = 0; i < tz_counter; i++) {
> > > + if (x86_pkg_temp_tz[i]) {
> > run() is quite long. Maybe move content of of this loop would help.
> > Something like this (use whatever function name) would help the
> > readability.
> > for (int i = 0; i < tz_counter; i++) {
> > if (x86_pkg_temp_tz[i])
> > test_zone(x86_pkg_temp_tz[i]);
> > }
> > Maybe even split the while part into it's own function.
> Changed. I wanted to avoid creating functions that were only used once.
Understand, but there is also code readability which matters.
...
> > > +
> > > + while (sleep_time > 0) {
> > > + tst_res(TDEBUG, "Running for %f
> > > seconds, then sleeping for %d seconds", run_time, sleep_time);
> > nit: %f should be %d, right?
> run_time is double, because difftime returns double. Switching to %d
> causes a warning. If you prefer, I might add casting to int and then
> %d.
The output looks better but it's very minor.
Kind regards,
Petr
--
Mailing list info: https://lists.linux.it/listinfo/ltp
next prev parent reply other threads:[~2026-01-29 12:59 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-01-23 12:49 [LTP] [PATCH v4] thermal: add new test group Piotr Kubaj
2026-01-23 20:25 ` Petr Vorel
2026-01-29 11:15 ` Kubaj, Piotr
2026-01-29 12:58 ` Petr Vorel [this message]
-- strict thread matches above, loose matches on Subject: below --
2025-11-24 10:51 Piotr Kubaj
2025-11-28 11:02 ` Petr Vorel
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=20260129125840.GA102011@pevik \
--to=pvorel@suse.cz \
--cc=daniel.niestepski@intel.com \
--cc=helena.anna.dubel@intel.com \
--cc=ltp@lists.linux.it \
--cc=piotr.kubaj@intel.com \
--cc=rafael.j.wysocki@intel.com \
--cc=tomasz.ossowski@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