summaryrefslogtreecommitdiff
path: root/src/scripts
diff options
context:
space:
mode:
authorCarsten Haitzler (Rasterman) <raster@rasterman.com>2020-01-06 16:35:59 +0000
committerCarsten Haitzler (Rasterman) <raster@rasterman.com>2020-01-06 16:36:31 +0000
commit1dd06a1e3d91d2c81a824b159d586ad62144fedb (patch)
treebc6a34255694a27ca7f70c5f540c500ea786e8cd /src/scripts
parentcdaecf2dfb6d10cd1376623a5377b195e777dd57 (diff)
scripts - eina - remove eina-bench-cmp as its disbaled from install
it's also py2 which makes it EOL anyway...
Diffstat (limited to 'src/scripts')
-rwxr-xr-xsrc/scripts/eina/eina-bench-cmp249
-rw-r--r--src/scripts/eina/meson.build4
-rw-r--r--src/scripts/meson.build1
3 files changed, 0 insertions, 254 deletions
diff --git a/src/scripts/eina/eina-bench-cmp b/src/scripts/eina/eina-bench-cmp
deleted file mode 100755
index 9ff68e2a2c..0000000000
--- a/src/scripts/eina/eina-bench-cmp
+++ /dev/null
@@ -1,249 +0,0 @@
1#!/usr/bin/env python2
2
3import os
4import os.path
5import csv
6from optparse import OptionParser
7
8fmttext = '%(value)7.2f (%(percentual)+6.1f%%)'
9fmthtml = '%(value)7.2f <span style="color: #666; width: 55pt; display: inline-block; text-align: right; text-shadow: #999 1px 1px 3px;">(%(percentual)+0.1f%%)</span>'
10
11
12parser = OptionParser(usage="%prog [options] <reference> <file2> .. <fileN>",
13 description="""\
14Generate reports comparing two or more outputs of expedite.
15
16Just run expedite and save output to a file and then feed them to this
17program. The first file is used as base for comparison and other files
18will print relative improvements.
19""")
20parser.add_option("-e", "--accepted-error",
21 help=("maximum error to accept as percentage 0.0-1.0. "
22 "[default=%default]"),
23 action="store", type="float", default=0.05)
24parser.add_option("-r", "--report",
25 help=("kind of report to use. One of text or html. "
26 "[default=%default]"),
27 action="store", type="choice", default="text",
28 choices=["text", "html"])
29parser.add_option("-F", "--format",
30 help=("format to use as python format string, "
31 "valid keys are: value and percentual. "
32 "[defaults: html=\"%s\", text=\"%s\"]" %
33 (fmthtml, fmttext)),
34 action="store", type="str", default=None)
35parser.add_option("-C", "--no-color", dest="color",
36 help="do not use color in reports.",
37 action="store_false", default=True)
38
39options, files = parser.parse_args()
40if len(files) < 2:
41 raise SystemExit("need at least 2 files to compare")
42
43if options.format is None:
44 if options.report == "html":
45 options.format = fmthtml
46 else:
47 options.format = fmttext
48
49ref_f = files[0]
50others_f = files[1:]
51
52max_test_name = 0
53data = {}
54tests = []
55for f in files:
56 d = data[f] = {}
57 for row in csv.reader(open(f), delimiter='\t'):
58 if row[0].startswith("#"):
59 continue
60 t = row[0].strip()
61 if f == ref_f:
62 tests.append(t)
63 d[t] = float(row[1])
64 max_test_name = max(len(t), max_test_name)
65
66def report_text():
67 test_name_fmt = "%%%ds:" % max_test_name
68
69 fmtsize = len(options.format % {"value": 12345.67, "percentual": 1234.56})
70 hdrfmt = "%%%d.%ds" % (fmtsize, fmtsize)
71
72 print test_name_fmt % "\\",
73 print "%7.7s" % (files[0][-7:],),
74 for f in files[1:]:
75 n, e = os.path.splitext(f)
76 print hdrfmt % n[-fmtsize:],
77 print
78
79 if options.color and os.environ.get("TERM", "") in (
80 "xterm", "xterm-color", "rxvt", "rxvt-unicode", "screen",
81 "Eterm", "aterm", "gnome", "interix"):
82 color_good = "\033[1;32m"
83 color_bad = "\033[1;31m"
84 color_equal = "\033[1;30m"
85 color_reset = "\033[0m"
86 else:
87 color_good = ""
88 color_bad = ""
89 color_equal = ""
90 color_reset = ""
91
92
93 def print_row(test):
94 print test_name_fmt % test,
95 ref_val = data[ref_f][test]
96 print "%7.2f" % ref_val,
97 for f in others_f:
98 try:
99 val = data[f][test]
100 except KeyError:
101 print "-?????-",
102 continue
103
104 percent = (val - ref_val) / ref_val
105 if percent < -options.accepted_error:
106 c = color_good
107 elif percent > options.accepted_error:
108 c = color_bad
109 else:
110 c = color_equal
111
112 fmt = options.format % {"value": val, "percentual": percent * 100}
113 if len(fmt) < fmtsize:
114 fmt = hdrfmt % fmt
115 print "%s%s%s" % (c, fmt, color_reset),
116
117 print
118
119 for t in tests:
120 print_row(t)
121
122
123def report_html():
124 import time
125
126 fnames = [os.path.basename(f) for f in files]
127 print """\
128<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
129 "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
130
131<html xmlns="http://www.w3.org/1999/xhtml">
132 <head>
133 <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
134 <title>expedite comparison sheet: %(files)s</title>
135 </head>
136 <style type="text/css">
137 table
138 {
139 border: 1px solid black;
140 border-collapse: collapse;
141 }
142 thead
143 {
144 border-bottom: 1px solid black;
145 }
146 tr.overall-results
147 {
148 border-top: 1px solid black;
149 font-weight: bold;
150 }
151 td.value, td.value-reference, td.value-missing, td.value-good, td.value-bad, td.value-equal
152 {
153 font-family: courier, monospaced;
154 font-size: 10pt;
155 text-align: right;
156 border-left: 1px solid black;
157 border-bottom: 1px dashed #ccc;
158 }
159 td.test-name, thead tr td { text-align: right; }\
160"""
161 if options.color:
162 print """\
163 td.value-good { background-color: #aaffaa; }
164 td.value-bad { background-color: #ffaaaa; }
165 td.value-missing { background-color: #ffffaa; }
166 td.test-name, thead tr td
167 {
168 font-weight: bold;
169 background-color: #d9d9d9;
170 border-bottom: 1px dashed #ccc;
171 }
172"""
173
174 print """
175 </style>
176 <body>
177 <p>Comparison sheet for %(files)s, created at %(date)s.</p>
178 <table>
179 <thead>
180 <tr>
181 <td>\\</td>\
182""" % {"files": ", ".join(fnames),
183 "date": time.asctime(),
184 }
185
186 for f in fnames:
187 print """\
188 <td>%s</td>\
189""" % f
190 print """\
191 </tr>
192 </thead>
193 <tbody>\
194"""
195
196 def print_row(test):
197 ref_val = data[ref_f][test]
198 if "EVAS SPEED" in test.upper():
199 extra_cls = ' class="overall-results"'
200 else:
201 extra_cls = ""
202
203 print """\
204 <tr%s>
205 <td class="test-name">%s</td>
206 <td class="value-reference">%7.2f</td>\
207""" % (extra_cls, test, ref_val)
208
209 for f in others_f:
210 try:
211 val = data[f][test]
212 except KeyError:
213 print """\
214 <td class="value-missing">-?????-</td>\
215"""
216 continue
217
218 percent = (val - ref_val) / ref_val
219 if percent < -options.accepted_error:
220 c = 'good'
221 elif percent > options.accepted_error:
222 c = 'bad'
223 else:
224 c = 'equal'
225
226 v = options.format % {"value": val, "percentual": percent * 100}
227
228 print """\
229 <td class="value-%s">%s</td>\
230""" % (c, v)
231
232 print """\
233 </tr>\
234"""
235
236 for t in tests:
237 print_row(t)
238
239 print """\
240 </tbody>
241 </table>
242 </body>
243</html>
244"""
245
246if options.report == "text":
247 report_text()
248elif options.report == "html":
249 report_html()
diff --git a/src/scripts/eina/meson.build b/src/scripts/eina/meson.build
deleted file mode 100644
index d1d10ab6bf..0000000000
--- a/src/scripts/eina/meson.build
+++ /dev/null
@@ -1,4 +0,0 @@
1# disabled because its a pretty useless script that forces python as a
2# a dependency and doesn't parse anything efl or test apps produce
3#install_data('eina-bench-cmp', install_dir : dir_bin,
4# install_mode: 'rwxr-xr-x')
diff --git a/src/scripts/meson.build b/src/scripts/meson.build
index 304d437753..6057ad788a 100644
--- a/src/scripts/meson.build
+++ b/src/scripts/meson.build
@@ -1,3 +1,2 @@
1subdir('eo') 1subdir('eo')
2subdir('elua') 2subdir('elua')
3subdir('eina')