summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Willmann <daniel@totalueberwachung.de>2014-01-26 15:22:06 +0100
committerDaniel Willmann <daniel@totalueberwachung.de>2014-01-26 15:22:06 +0100
commit945496022ca936e488309c67445c3a5ace32955a (patch)
treecede88461b5f00a0d918d2c0f36bc84d5bfd8e33
parent8b433b7bd23b8d7d0f75ad4e2345ada4953e066e (diff)
graph-coverage: Add option to limit the number of points to graph
Default is now 30 which looks much better than just graphing all.
-rwxr-xr-xgraph-coverage.py15
1 files changed, 13 insertions, 2 deletions
diff --git a/graph-coverage.py b/graph-coverage.py
index e2a3179..f54005c 100755
--- a/graph-coverage.py
+++ b/graph-coverage.py
@@ -1,7 +1,7 @@
1#!/usr/bin/python 1#!/usr/bin/python
2 2
3# Copyright (c) Daniel Willmann <daniel@totalueberwachung.de> 3# Copyright (c) 2013 Samsung Electronics
4# Copyright (c) Samsung Electronics 4# Copyright (c) 2013-2014 Daniel Willmann <daniel@totalueberwachung.de>
5 5
6import os 6import os
7import argparse 7import argparse
@@ -29,6 +29,8 @@ graph.add_argument("-l", "--label", dest="label",
29 help="Label of the graph", default="") 29 help="Label of the graph", default="")
30graph.add_argument("-f", "--files", dest="files", action=MakeList, 30graph.add_argument("-f", "--files", dest="files", action=MakeList,
31 help="Only use these files for calculation") 31 help="Only use these files for calculation")
32graph.add_argument("-m", "--max-points", dest="max_points", type=int, default=30,
33 help="Only display the last N coverage points (default 30)")
32 34
33parser.add_argument("-q", "--quiet", 35parser.add_argument("-q", "--quiet",
34 action="store_false", dest="verbose", default=True, 36 action="store_false", dest="verbose", default=True,
@@ -138,6 +140,10 @@ if options.graph:
138 140
139 dates = c.execute("SELECT DISTINCT date from coverage ORDER BY date").fetchall() 141 dates = c.execute("SELECT DISTINCT date from coverage ORDER BY date").fetchall()
140 142
143 # Only graph the last x coverage points
144 if (len(dates) > options.max_points):
145 dates = dates[-options.max_points:]
146
141 fn_per = [] 147 fn_per = []
142 ln_per = [] 148 ln_per = []
143 149
@@ -154,6 +160,11 @@ if options.graph:
154 query = c.execute(querystr, params) 160 query = c.execute(querystr, params)
155 161
156 for result in query.fetchall(): 162 for result in query.fetchall():
163 if not result[0]:
164 print "Missing coverage information"
165 fn_per.append(0.0)
166 ln_per.append(0.0)
167 continue
157 print result[0] 168 print result[0]
158 print "Function coverage: % 3.2f%%" % (float(result[2])/result[1] * 100, ) 169 print "Function coverage: % 3.2f%%" % (float(result[2])/result[1] * 100, )
159 print "Line coverage: % 3.2f%%" % (float(result[4])/result[3] * 100, ) 170 print "Line coverage: % 3.2f%%" % (float(result[4])/result[3] * 100, )