OmniSciDB  72c90bc290
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
analyze_benchmark.PrettyPrint Class Reference

Public Member Functions

def __init__
 
def collectMissingQueries
 
def printSolidLine
 
def printHeader
 
def getRefElementsPerLine
 
def printLine
 
def printAttribute
 

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

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.

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

Member Function Documentation

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, and analyze_benchmark.PrettyPrint.__label_name_sample.

192  def collectMissingQueries(self):
193  for query in self.__label_name_ref:
194  if query not in self.__label_name_sample:
195  self.__missing_queries_sample.append(query)
196  self.__label_name_ref.remove(query)
197  for query in self.__label_name_sample:
198  if query not in self.__label_name_ref:
199  self.__missing_queries_ref.append(query)
200  self.__label_name_sample.remove(query)
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().

213  def getRefElementsPerLine(self):
214  return self.__ref_line_count * self.__num_items_per_line

+ Here is the caller graph for this function:

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().

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

+ Here is the call graph for this function:

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().

208  def printHeader(self):
209  for h in self.__header_info:
210  print("\t" + h)
211  self.printSolidLine("=")

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

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().

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

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

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().

202  def printSolidLine(self, pattern):
203  for i in range(self.__num_items_per_line + 1):
204  for j in range(11):
205  print(pattern, end="")
206  print("")

+ Here is the caller graph for this function:

Member Data Documentation

analyze_benchmark.PrettyPrint.__attribute_ref
private

Definition at line 180 of file analyze_benchmark.py.

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

analyze_benchmark.PrettyPrint.__attribute_sample
private

Definition at line 184 of file analyze_benchmark.py.

Referenced by analyze_benchmark.PrettyPrint.printAttribute().

analyze_benchmark.PrettyPrint.__cross_comparison
private

Definition at line 162 of file analyze_benchmark.py.

Referenced by analyze_benchmark.PrettyPrint.printAttribute().

analyze_benchmark.PrettyPrint.__header_info
private

Definition at line 166 of file analyze_benchmark.py.

Referenced by analyze_benchmark.PrettyPrint.printHeader().

analyze_benchmark.PrettyPrint.__label_name_ref
private

Definition at line 172 of file analyze_benchmark.py.

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

analyze_benchmark.PrettyPrint.__label_name_sample
private

Definition at line 174 of file analyze_benchmark.py.

Referenced by analyze_benchmark.PrettyPrint.collectMissingQueries().

analyze_benchmark.PrettyPrint.__missing_queries_ref
private

Definition at line 176 of file analyze_benchmark.py.

analyze_benchmark.PrettyPrint.__missing_queries_sample
private

Definition at line 177 of file analyze_benchmark.py.

analyze_benchmark.PrettyPrint.__num_items_per_line
private

Definition at line 171 of file analyze_benchmark.py.

Referenced by analyze_benchmark.PrettyPrint.getRefElementsPerLine(), analyze_benchmark.PrettyPrint.printLine(), and analyze_benchmark.PrettyPrint.printSolidLine().

analyze_benchmark.PrettyPrint.__ref_line_count
private

Definition at line 187 of file analyze_benchmark.py.

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

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: