2008/6/16 Rafael Vanoni <Rafael.Vanoni at sun.com>:
> Here's a diff that fixes the last three bugs listed on the powertop project
> page:
>
> # PowerTOP does not exit with non-zero exit code if handed an invalid option
> # PowerTOP works with invalid options
> # PowerTOP dumps usage message to stdout, not stderr

-       if ((bit_depth = get_bit_depth()) < 0)
-               return -1;
+       if ((bit_depth = get_bit_depth()) < 0) {
+               exit(EXIT_FAILURE);
+               return (EXIT_FAILURE);
+       }

Why exit(EXIT_FAILURE) needed here?

+
+       if (argc > 1)
+               if (argv[1][0] != '-')
+                       usage();

This code looks ugly, and not a fix if run "powertop --"
Any better idea?

>
> I also would like to remove the following piece of code from powertop.c
>
>                /*
>                 * Quiet down the effects of any IO to xterms
>                 */
>                if (!key && ticktime >= 4.8) {
>                        FD_ZERO(&rfds);
>                        FD_SET(0, &rfds);
>                        tv.tv_sec = 3;
>                        tv.tv_usec = 0;
>                        key = select(1, &rfds, NULL, NULL, &tv);
>                }
>
> As the expected functionality is broken and is causing these two bugs:
>
> # Time interval is not constant
> # Multiple PowerTop instances experience time interval fluctuation
>
> An alternative would be to calculate the '4.8' during execution, but I don't
> know what to base it on.
>
> What do you think ?

Why time interval has to be constant?

Thanks,
-Aubrey

Reply via email to