Curently powertop report is created for a period of 20 secs
by default. This patch adds a new argument --time which can be used
to specify the time in secs to create the powertop report.
---
main.cpp | 55 ++++++++++++++++++++++++++++++++++++-------------------
1 files changed, 36 insertions(+), 19 deletions(-)
diff --git a/main.cpp b/main.cpp
index 9fc358c..ffbff22 100644
--- a/main.cpp
+++ b/main.cpp
@@ -66,6 +66,7 @@ static const struct option long_options[] =
{"calibrate",no_argument, NULL, 'c'},
{"html", optional_argument, NULL, 'h'},
{"extech", optional_argument, NULL, 'e'},
+ {"time", optional_argument, NULL, 't'},
{NULL, 0, NULL, 0}
};
@@ -82,6 +83,7 @@ static void print_usage()
printf(_("--calibrate \t runs powertop in calibration mode\n"));
printf(_("--extech=devnode \t uses an Extech Power Analyzer for
measurements\n"));
printf(_("--html[=FILENAME]\t\t generate a html report\n"));
+ printf(_("--time[=secs]\t\t generate a html report for secs\n"));
printf(_("--help \t\t print this help menu\n"));
printf("\n");
printf(_("For more help please refer to the README\n\n"));
@@ -192,6 +194,33 @@ void out_of_memory()
abort();
}
+void html_report(int time, bool file)
+{
+ fprintf(stderr, _("Measuring for %d seconds\n"),time);
+ /* one to warm up everything */
+ utf_ok = 0;
+ one_measurement(1);
+
+ if(file)
+ init_html_output( (optarg ? optarg : "powertop.html"));
+ else
+ init_html_output("powertop.html");
+
+ initialize_tuning();
+ /* and then the real measurement */
+ one_measurement(time);
+ html_show_tunables();
+
+ finish_html_output();
+
+ /* and wrap up */
+ learn_parameters(50, 0);
+ save_all_results("/var/cache/powertop/saved_results.powertop");
+ save_parameters("/var/cache/powertop/saved_parameters.powertop");
+ end_pci_access();
+ exit(0);
+}
+
int main(int argc, char **argv)
{
int uid;
@@ -235,7 +264,7 @@ int main(int argc, char **argv)
while (1) { /* parse commandline options */
- c = getopt_long (argc, argv, "ch:uV", long_options,
&option_index);
+ c = getopt_long (argc, argv, "ch:t:uV", long_options,
&option_index);
/* Detect the end of the options. */
if (c == -1)
@@ -260,26 +289,14 @@ int main(int argc, char **argv)
break;
case 'h': /* html report */
- fprintf(stderr, _("Measuring for 20
seconds\n"));
- /* one to warm up everything */
- utf_ok = 0;
- one_measurement(1);
- init_html_output( (optarg ? optarg :
"powertop.html"));
- initialize_tuning();
- /* and then the real measurement */
- one_measurement(20);
- html_show_tunables();
-
- finish_html_output();
-
- /* and wrap up */
- learn_parameters(50, 0);
-
save_all_results("/var/cache/powertop/saved_results.powertop");
-
save_parameters("/var/cache/powertop/saved_parameters.powertop");
- end_pci_access();
- exit(0);
+ html_report(20, TRUE);
+ break;
+
+ case 't': /* html report */
+ html_report((optarg ? atoi(optarg) : 20),
FALSE);
break;
+
case '?': /* Unknown option */
/* getopt_long already printed an error
message. */
break;
--
1.7.0.4
---------------------------------------------------------------------
Intel Corporation SAS (French simplified joint stock company)
Registered headquarters: "Les Montalets"- 2, rue de Paris,
92196 Meudon Cedex, France
Registration Number: 302 456 199 R.C.S. NANTERRE
Capital: 4,572,000 Euros
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.
_______________________________________________
Power mailing list
[email protected]
https://bughost.org/mailman/listinfo/power