Re: [PATCH] - Adding a simple usage statement to cairo-perf-chart

Matt Fischer <[email protected]>
Newsgroups gmane.comp.lib.cairo
Message-ID <[email protected]>
On 12/22/2012 04:38 AM, Uli Schlachter wrote:
> Hi,
>
> On 16.12.2012 05:48, Matt Fischer wrote:
>> 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.
> Since no one complained, I wanted to push this patch. However it doesn't apply,
> because of wrapped lines and tabs which were turned into spaces.
>
> Could you re-send the result from git format-patch as an attachment?
>
> Uli

Uli,

Sorry for the long delay, I somehow missed this reply until I was 
cleaning up my inbox today. The patch is attached.

-- 

Matthew (Matt) Fischer
LP: http://launchpad.net/~mfisch
IRC: mfisch

-- 
cairo mailing list
[email protected]
http://lists.cairographics.org/mailman/listinfo/cairo
0001-Adding-a-simple-usage-statement-to-cairo-perf-chart.patch (text/x-patch, 1.8 KB)
From e56a258951bd416aa6ceb5c7fa52d7ae3597862d Mon Sep 17 00:00:00 2001
From: Matthew Fischer <[email protected]>
Date: Sat, 9 Mar 2013 15:42:59 -0700
Subject: [PATCH] Adding a simple usage statement to cairo-perf-chart

---
 perf/cairo-perf-chart.c | 29 +++++++++++++++++++++++++++++
 1 file changed, 29 insertions(+)

diff --git a/perf/cairo-perf-chart.c b/perf/cairo-perf-chart.c
index 5a41d02..1faa964 100644
--- a/perf/cairo-perf-chart.c
+++ b/perf/cairo-perf-chart.c
@@ -999,6 +999,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[])
@@ -1028,6 +1053,10 @@ 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.8.1.2
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.