OmniSciDB  29e35f4d58
analyze_benchmark.PrettyPrint Class Reference

Public Member Functions

def __init__ (self, ref, sample, attribute, cross_comparison=True, num_items_per_line=5)
 
def collectMissingQueries (self)
 
def printSolidLine (self, pattern)
 
def printHeader (self)
 
def getRefElementsPerLine (self)
 
def printLine (self, array)
 
def printAttribute (self)
 

Private Attributes

 __cross_comparison
 
 __header_info
 
 __num_items_per_line
 
 __label_name_ref
 
 __label_name_sample
 
 __missing_queries_ref
 
 __missing_queries_sample
 
 __attribute_ref
 
 __attribute_sample
 
 __ref_line_count
 
 __sample_line_count
 

Detailed Description

    This class is just used to print out the benchmark results into the terminal.
    By default, it is used for cross comparison of the results between a reference 
    branch (ref) and a sample branch (sample); for a particular attribute, all elements 
    within each branch are shown as well as the speedup (sample / ref).

    If cross_comparison is disabled, then it just shows the result for the ref branch.

Definition at line 144 of file analyze_benchmark.py.

Constructor & Destructor Documentation

◆ __init__()

def analyze_benchmark.PrettyPrint.__init__ (   self,
  ref,
  sample,
  attribute,
  cross_comparison = True,
  num_items_per_line = 5 
)

Definition at line 161 of file analyze_benchmark.py.

161  ):
162  self.__cross_comparison = cross_comparison
163  assert isinstance(ref, BenchmarkLoader)
164  if cross_comparison:
165  assert isinstance(sample, BenchmarkLoader)
166  self.__header_info = [
167  ref.getRunTableName(),
168  attribute,
169  ref.getGpuName(),
170  ]
171  self.__num_items_per_line = num_items_per_line
172  self.__label_name_ref = ref.fetchQueryNames()
173  if cross_comparison:
174  self.__label_name_sample = sample.fetchQueryNames()
175  assert self.__label_name_ref == self.__label_name_sample
176  self.__missing_queries_ref = []
177  self.__missing_queries_sample = []
178  if cross_comparison:
179  self.collectMissingQueries()
180  self.__attribute_ref = ref.fetchAttribute(
181  attribute, self.__label_name_ref
182  )
183  if cross_comparison:
184  self.__attribute_sample = sample.fetchAttribute(
185  attribute, self.__label_name_sample
186  )
187  self.__ref_line_count = 0
188  self.__sample_line_count = 0
189 

Member Function Documentation

◆ collectMissingQueries()

def analyze_benchmark.PrettyPrint.collectMissingQueries (   self)

Definition at line 191 of file analyze_benchmark.py.

References analyze_benchmark.BenchAnalyzer.__label_name_ref, analyze_benchmark.PrettyPrint.__label_name_ref, analyze_benchmark.BenchAnalyzer.__label_name_sample, analyze_benchmark.PrettyPrint.__label_name_sample, analyze_benchmark.BenchAnalyzer.__missing_queries_ref, analyze_benchmark.PrettyPrint.__missing_queries_ref, analyze_benchmark.BenchAnalyzer.__missing_queries_sample, analyze_benchmark.PrettyPrint.__missing_queries_sample, and File_Namespace.append().

191  def collectMissingQueries(self):
192  for query in self.__label_name_ref:
193  if query not in self.__label_name_sample:
194  self.__missing_queries_sample.append(query)
195  self.__label_name_ref.remove(query)
196  for query in self.__label_name_sample:
197  if query not in self.__label_name_ref:
198  self.__missing_queries_ref.append(query)
199  self.__label_name_sample.remove(query)
200 
size_t append(FILE *f, const size_t size, int8_t *buf)
Appends the specified number of bytes to the end of the file f from buf.
Definition: File.cpp:135
+ Here is the call graph for this function:

◆ getRefElementsPerLine()

def analyze_benchmark.PrettyPrint.getRefElementsPerLine (   self)

Definition at line 212 of file analyze_benchmark.py.

References analyze_benchmark.PrettyPrint.__num_items_per_line, and analyze_benchmark.PrettyPrint.__ref_line_count.

Referenced by analyze_benchmark.PrettyPrint.printAttribute(), and analyze_benchmark.PrettyPrint.printLine().

212  def getRefElementsPerLine(self):
213  return self.__ref_line_count * self.__num_items_per_line
214 
+ Here is the caller graph for this function:

◆ printAttribute()

def analyze_benchmark.PrettyPrint.printAttribute (   self)

Definition at line 227 of file analyze_benchmark.py.

References analyze_benchmark.BenchAnalyzer.__attribute_ref, analyze_benchmark.PrettyPrint.__attribute_ref, analyze_benchmark.BenchAnalyzer.__attribute_sample, analyze_benchmark.PrettyPrint.__attribute_sample, analyze_benchmark.PrettyPrint.__cross_comparison, analyze_benchmark.BenchAnalyzer.__label_name_ref, analyze_benchmark.PrettyPrint.__label_name_ref, analyze_benchmark.PrettyPrint.__ref_line_count, analyze_benchmark.compute_speedup(), analyze_benchmark.PrettyPrint.getRefElementsPerLine(), analyze_benchmark.BenchAnalyzer.printHeader(), analyze_benchmark.PrettyPrint.printHeader(), analyze_benchmark.PrettyPrint.printLine(), and analyze_benchmark.PrettyPrint.printSolidLine().

227  def printAttribute(self):
228  self.printHeader()
229  ref_count = len(self.__attribute_ref)
230  while self.getRefElementsPerLine() < ref_count:
231  print("%10s" % "Queries", end="")
232  self.printLine(self.__label_name_ref)
233  self.printSolidLine("-")
234  print("%10s" % "Reference", end="")
235  self.printLine(self.__attribute_ref)
236  if self.__cross_comparison:
237  print("%10s" % "Sample", end="")
238  self.printLine(self.__attribute_sample)
239  print("%10s" % "Speedup", end="")
240  self.printLine(
242  self.__attribute_ref, self.__attribute_sample
243  )
244  )
245  self.printSolidLine("=")
246  self.__ref_line_count += 1
247  print("\n\n\n")
248 
249 
+ Here is the call graph for this function:

◆ printHeader()

def analyze_benchmark.PrettyPrint.printHeader (   self)

Definition at line 207 of file analyze_benchmark.py.

References analyze_benchmark.BenchAnalyzer.__header_info, analyze_benchmark.PrettyPrint.__header_info, and analyze_benchmark.PrettyPrint.printSolidLine().

Referenced by analyze_benchmark.PrettyPrint.printAttribute().

207  def printHeader(self):
208  for h in self.__header_info:
209  print("\t" + h)
210  self.printSolidLine("=")
211 
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ printLine()

def analyze_benchmark.PrettyPrint.printLine (   self,
  array 
)

Definition at line 215 of file analyze_benchmark.py.

References analyze_benchmark.BenchAnalyzer.__attribute_ref, analyze_benchmark.PrettyPrint.__attribute_ref, analyze_benchmark.PrettyPrint.__num_items_per_line, and analyze_benchmark.PrettyPrint.getRefElementsPerLine().

Referenced by analyze_benchmark.PrettyPrint.printAttribute().

215  def printLine(self, array):
216  begin = self.getRefElementsPerLine()
217  end = self.getRefElementsPerLine() + self.__num_items_per_line
218  for i in range(begin, min(end, len(self.__attribute_ref))):
219  if isinstance(array[i], float):
220  print("%10.2f" % (array[i]), end="")
221  elif isinstance(array[i], str):
222  print("%10s" % (array[i]), end="")
223  else:
224  assert False
225  print("")
226 
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ printSolidLine()

def analyze_benchmark.PrettyPrint.printSolidLine (   self,
  pattern 
)

Definition at line 201 of file analyze_benchmark.py.

References analyze_benchmark.PrettyPrint.__num_items_per_line.

Referenced by analyze_benchmark.PrettyPrint.printAttribute(), and analyze_benchmark.PrettyPrint.printHeader().

201  def printSolidLine(self, pattern):
202  for i in range(self.__num_items_per_line + 1):
203  for j in range(11):
204  print(pattern, end="")
205  print("")
206 
+ Here is the caller graph for this function:

Member Data Documentation

◆ __attribute_ref

analyze_benchmark.PrettyPrint.__attribute_ref
private

◆ __attribute_sample

analyze_benchmark.PrettyPrint.__attribute_sample
private

Definition at line 184 of file analyze_benchmark.py.

Referenced by analyze_benchmark.PrettyPrint.printAttribute().

◆ __cross_comparison

analyze_benchmark.PrettyPrint.__cross_comparison
private

Definition at line 162 of file analyze_benchmark.py.

Referenced by analyze_benchmark.PrettyPrint.printAttribute().

◆ __header_info

analyze_benchmark.PrettyPrint.__header_info
private

Definition at line 166 of file analyze_benchmark.py.

Referenced by analyze_benchmark.PrettyPrint.printHeader().

◆ __label_name_ref

analyze_benchmark.PrettyPrint.__label_name_ref
private

◆ __label_name_sample

analyze_benchmark.PrettyPrint.__label_name_sample
private

◆ __missing_queries_ref

analyze_benchmark.PrettyPrint.__missing_queries_ref
private

◆ __missing_queries_sample

analyze_benchmark.PrettyPrint.__missing_queries_sample
private

◆ __num_items_per_line

analyze_benchmark.PrettyPrint.__num_items_per_line
private

◆ __ref_line_count

analyze_benchmark.PrettyPrint.__ref_line_count
private

◆ __sample_line_count

analyze_benchmark.PrettyPrint.__sample_line_count
private

Definition at line 188 of file analyze_benchmark.py.


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