[PATCH] - Adding a simple usage statement to cairo-perf-chart
Matt Fischer <[email protected]>
| Newsgroups | gmane.comp.lib.cairo |
|---|---|
| Message-ID | <[email protected]> |
I was running some perf charts recently and ended up having to grab the source to figure out all the options. This adds a simple usage statement to make this easier for the next person. Hope this is useful. From b569aa14a100a09b8cb073cf084ac3202f8bb089 Mon Sep 17 00:00:00 2001 From: Matthew Fischer <[email protected]> Date: Sat, 15 Dec 2012 20:52:24 -0700 Subject: [PATCH] Adding a simple usage statement to cairo-perf-chart Adds a simple usage statement to cairo-perf-chart. This saves people from having to download the source code in order to see what the options are. --- perf/cairo-perf-chart.c | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/perf/cairo-perf-chart.c b/perf/cairo-perf-chart.c index a993ce8..46f31b0 100644 --- a/perf/cairo-perf-chart.c +++ b/perf/cairo-perf-chart.c @@ -889,6 +889,31 @@ add_legend (struct chart *chart) } } +static void +usage (void) +{ + printf("Usage:\n"); + printf(" cairo-perf-chart [OPTION...] <result1> <result2>...<resultN>\n"); + printf("\n"); + printf("Help Options:\n"); + printf(" --help, --?\tShow help options\n"); + printf("\n"); + printf("Application Options:\n"); + printf(" --html\tOutput an HTML table comparing the results\n"); + printf(" --height=\tSet the height of the output graph"\ + " (default 480)\n"); + printf(" --width=\tSet the width of the output graph"\ + " (default 640)\n"); + printf(" --name\tSet the name of graph series."\ + " This only sets the name for the\n\t\tfirst result file."\ + " The graph series is usually set using the\n\t\tfile name for"\ + " the results file.\n"); + printf("\n"); + printf("Example:\n"); + printf(" cairo-perf-chart --width=1024 --height=768 run1 run2 run3\n"); + return; +} + int main (int argc, const char *argv[]) @@ -918,6 +943,11 @@ main (int argc, chart.names[chart.num_reports] = argv[++i]; } else if (strncmp (argv[i], "--name=", 7) == 0) { chart.names[chart.num_reports] = argv[i] + 7; + } else if ((strcmp (argv[i], "--help") == 0) || + (strcmp (argv[i], "--?") == 0)) + { + usage(); + return 0; } else { cairo_perf_report_load (&chart.reports[chart.num_reports++], argv[i], i, -- 1.7.10.4 -- Matthew (Matt) Fischer LP: http://launchpad.net/~mfisch IRC: mfisch -- cairo mailing list [email protected] http://lists.cairographics.org/mailman/listinfo/cairo