OmniSciDB  a5dc49c757
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
report.Row Class Reference

Public Member Functions

def __init__
 
def cell
 
def fixup_header
 
def fixup_row
 
def tr
 

Public Attributes

 header
 
 row
 
 duration_idx
 
 avg_idx
 
 z_score_idx
 

Detailed Description

Definition at line 119 of file report.py.

Constructor & Destructor Documentation

def report.Row.__init__ (   self,
  header,
  row 
)

Definition at line 120 of file report.py.

121  def __init__(self, header, row):
122  self.header = self.fixup_header(header)
123  self.row = self.fixup_row(row) if row != None else self.fixup_header(header)
124  self.duration_idx = self.header.index('duration_ms')
125  self.avg_idx = self.header.index('avg')
126  self.z_score_idx = self.header.index('z_score')
duration_idx
Definition: report.py:123
def __init__
Definition: report.py:120
def fixup_row
Definition: report.py:173
def fixup_header
Definition: report.py:166

Member Function Documentation

def report.Row.cell (   self,
  tag,
  idx,
  value 
)

Definition at line 128 of file report.py.

References report.Row.avg_idx, report.Row.duration_idx, report.Row.row, run_benchmark_import.type, and report.Row.z_score_idx.

Referenced by report.Row.tr().

129  def cell(self, tag, idx, value):
130  if type(value) is str:
131  return '<{0}>{1}</{0}>'.format(tag, value)
132  else:
133  if self.z_score_idx == idx:
134  if value == None:
135  if self.row[self.avg_idx] == None:
136  return '<{0}>{1}</{0}>'.format(tag, value)
137  else:
138  stats['nerrors'] += 1
139  return '<{0} class="error">{1}</{0}>'.format(tag, value)
140  if stats['worst_z_score'] < value:
141  stats['worst_z_score'] = value
142  if value <= -ZSCORE_ERROR:
143  stats['nfixes'] += 1
144  return '<{0} class="fixed">{1:0.3f}</{0}>'.format(tag, value)
145  elif value < ZSCORE_CHECK:
146  return '<{0}>{1:0.3f}</{0}>'.format(tag, value)
147  elif value < ZSCORE_WARNING:
148  stats['nchecks'] += 1
149  return '<{0} class="check">{1:0.3f}</{0}>'.format(tag, value)
150  elif value < ZSCORE_ERROR:
151  stats['nwarnings'] += 1
152  return '<{0} class="warning">{1:0.3f}</{0}>'.format(tag, value)
153  else:
154  stats['nerrors'] += 1
155  return '<{0} class="error">{1:0.3f}</{0}>'.format(tag, value)
156  else:
157  if value == None:
158  return '<{0}>{1}</{0}>'.format(tag, value)
159  else:
160  if self.duration_idx == idx and self.row[self.avg_idx] == None:
161  stats['nfixes'] += 1
162  return '<{0} class="fixed">{1:0.3f}</{0}>'.format(tag, value)
163  else:
164  return '<{0}>{1:0.3f}</{0}>'.format(tag, value)
def cell
Definition: report.py:128
duration_idx
Definition: report.py:123

+ Here is the caller graph for this function:

def report.Row.fixup_header (   self,
  header 
)

Definition at line 166 of file report.py.

167  def fixup_header(self, header):
168  fixup = header[:] # copy, not reference
169  fixup.remove('benchmark_id') # Used in benchmark_detail_url
170  fixup.remove('benchmark_name') # Column "name" is based on both "name" and "benchmark_name".
171  return fixup
def fixup_header
Definition: report.py:166
def report.Row.fixup_row (   self,
  row_tuple 
)

Definition at line 173 of file report.py.

174  def fixup_row(self, row_tuple):
175  row = list(row_tuple)
176  benchmark_id = header.index('benchmark_id')
177  name = header.index('name')
178  benchmark_name = header.index('benchmark_name')
179  # Combine name and benchmark_name together into a single column.
180  if row[name] == 'StringDictionaryBenchmark':
181  p = re.compile('\w+/(\w+)')
182  md = p.search(row[benchmark_name])
183  row[name] = 'StringDictionary {}'.format(md.group(1))
184  else:
185  row[name] = '{} {}'.format(row[name], row[benchmark_name])
186  # Hyperlink benchmark name to the conbench page for the specific benchmark.
187  row[name] = '<a href="{}">{}</a>'.format(benchmark_detail_url.format(row[benchmark_id]), row[name])
188  assert(benchmark_id < benchmark_name) # Must match column removals in fixup_header().
189  del row[benchmark_name]
190  del row[benchmark_id]
191  return row
def fixup_row
Definition: report.py:173
def report.Row.tr (   self,
  tag 
)

Definition at line 193 of file report.py.

References report.Row.cell(), join(), and report.Row.row.

194  def tr(self, tag):
195  zscore_idx = len(self.row) - 1
196  return '<tr>{}</tr>'.format(''.join([self.cell(tag,idx,value) for idx, value in enumerate(self.row)]))
def tr
Definition: report.py:193
def cell
Definition: report.py:128
std::string join(T const &container, std::string const &delim)

+ Here is the call graph for this function:

Member Data Documentation

report.Row.avg_idx

Definition at line 124 of file report.py.

Referenced by report.Row.cell().

report.Row.duration_idx

Definition at line 123 of file report.py.

Referenced by report.Row.cell().

report.Row.header

Definition at line 121 of file report.py.

report.Row.row

Definition at line 122 of file report.py.

Referenced by report.Row.cell(), and report.Row.tr().

report.Row.z_score_idx

Definition at line 125 of file report.py.

Referenced by report.Row.cell().


The documentation for this class was generated from the following file: