Re: [PATCH][RFC] tools/power turbostat: if --max_loop, print for specific time of loops

From: Bityutskiy, Artem
Date: Tue Apr 10 2018 - 07:02:32 EST


On Tue, 2018-04-10 at 18:18 +0800, Yu Chen wrote:
> @@ -5076,6 +5084,15 @@ void cmdline(int argc, char **argv)
> print_version();
> exit(0);
> break;
> + case 'x':
> + {
> + unsigned int loops = strtod(optarg, NULL);

It would make sense to error out here if you get a value <= 0.

> +
> + if (loops % 2)
> + loops++;

What is this for?

> + max_loops = loops;

Is the "loops" variable really needed? Can you strtod directly to
max_loops?

--
Best Regards,
Artem Bityutskiy
---------------------------------------------------------------------
Intel Finland Oy
Registered Address: PL 281, 00181 Helsinki
Business Identity Code: 0357606 - 4
Domiciled in Helsinki

This e-mail and any attachments may contain confidential material for
the sole use of the intended recipient(s). Any review or distribution
by others is strictly prohibited. If you are not the intended
recipient, please contact the sender and delete all copies.