From: John Mathew <[email protected]>
-h for help and -t option for time to report
---
main.cpp | 43 ++++++++++++++++++++++++++++++++++++++-----
1 files changed, 38 insertions(+), 5 deletions(-)
diff --git a/main.cpp b/main.cpp
index c5b8a60..328f148 100644
--- a/main.cpp
+++ b/main.cpp
@@ -156,9 +156,28 @@ void out_of_memory()
abort();
}
+void usage()
+{
+ printf(_("Usage: powertop [OPTION...]\n"));
+ printf(_(" -c, --calibrate make estimation more accurate by
running a calibration\n"));
+ printf(_(" -t, --time=DOUBLE default time to gather data in
seconds\n"));
+ printf(_(" -d, --debug debug learning\n"));
+ printf(_(" -h, --help Show this help message\n"));
+ printf(_(" -r, --html create a powertop.html report\n"));
+ printf(_(" -v, --version Show version information and
exit\n"));
+ exit(0);
+}
+
+void version()
+{
+ printf(_("powertop version %s\n"), POWERTOP_VERSION);
+ exit(0);
+}
+
int main(int argc, char **argv)
{
int uid;
+ double ticktime = 20.0;
set_new_handler(out_of_memory);
@@ -196,12 +215,22 @@ int main(int argc, char **argv)
register_parameter("disk-operations", 0.0);
if (argc > 1) {
- if (strcmp(argv[1], "--calibrate") == 0)
+ if (strcmp(argv[1], "--calibrate") == 0 || strcmp(argv[1],
"-c") == 0)
calibrate();
}
if (argc > 1) {
- if (strcmp(argv[1], "--debug") == 0)
+ if (strcmp(argv[1], "-h") == 0 || strcmp(argv[1], "--help") ==
0)
+ usage();
+ }
+
+ if (argc > 1) {
+ if (strcmp(argv[1], "-v") == 0 || strcmp(argv[1], "--version")
== 0)
+ version();
+ }
+
+ if (argc > 1) {
+ if (strcmp(argv[1], "--debug") == 0 || strcmp(argv[1], "-d") ==
0)
debug_learning = 1;
}
@@ -211,15 +240,19 @@ int main(int argc, char **argv)
}
if (argc > 1) {
- if (strcmp(argv[1], "--html") == 0) {
- fprintf(stderr, _("Measuring for 20 seconds\n"));
+ if (strcmp(argv[1], "--html") == 0 || strcmp(argv[1], "-r") ==
0){
+ if (argc > 2) {
+ ticktime = strtod(argv[2], NULL);
+ }
+
+ fprintf(stderr, _("Measuring for %i seconds\n"),
(int)ticktime);
/* one to warm up everything */
utf_ok = 0;
one_measurement(1);
init_html_output("powertop.html");
initialize_tuning();
/* and then the real measurement */
- one_measurement(20);
+ one_measurement(ticktime);
html_show_tunables();
finish_html_output();
--
1.7.1
_______________________________________________
Power mailing list
[email protected]
http://www.bughost.org/mailman/listinfo/power