OmniSciDB  c07336695a
analyze-benchmark.PrettyPrint Class Reference

Public Member Functions

def __init__ (self, ref, sample, attribute, 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

 __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

Definition at line 138 of file analyze-benchmark.py.

Constructor & Destructor Documentation

◆ __init__()

def analyze-benchmark.PrettyPrint.__init__ (   self,
  ref,
  sample,
  attribute,
  num_items_per_line = 5 
)

Definition at line 139 of file analyze-benchmark.py.

139  def __init__(self, ref, sample, attribute, num_items_per_line=5):
140  assert isinstance(ref, BenchmarkLoader)
141  assert isinstance(sample, BenchmarkLoader)
142  self.__header_info = [
143  ref.getRunTableName(),
144  attribute,
145  ref.getGpuName(),
146  ]
147  self.__num_items_per_line = num_items_per_line
148  self.__label_name_ref = ref.fetchQueryNames()
149  self.__label_name_sample = sample.fetchQueryNames()
150  self.__missing_queries_ref = []
151  self.__missing_queries_sample = []
152  self.collectMissingQueries()
153  assert self.__label_name_ref == self.__label_name_sample
154  self.__attribute_ref = ref.fetchAttribute(
155  attribute, self.__label_name_ref
156  )
157  self.__attribute_sample = sample.fetchAttribute(
158  attribute, self.__label_name_sample
159  )
160  self.__ref_line_count = 0
161  self.__sample_line_count = 0
162 

Member Function Documentation

◆ collectMissingQueries()

def analyze-benchmark.PrettyPrint.collectMissingQueries (   self)

Definition at line 164 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().

164  def collectMissingQueries(self):
165  for query in self.__label_name_ref:
166  if query not in self.__label_name_sample:
167  self.__missing_queries_sample.append(query)
168  self.__label_name_ref.remove(query)
169  for query in self.__label_name_sample:
170  if query not in self.__label_name_ref:
171  self.__missing_queries_ref.append(query)
172  self.__label_name_sample.remove(query)
173 
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:136
+ Here is the call graph for this function:

◆ getRefElementsPerLine()

def analyze-benchmark.PrettyPrint.getRefElementsPerLine (   self)

Definition at line 185 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().

185  def getRefElementsPerLine(self):
186  return self.__ref_line_count * self.__num_items_per_line
187 
+ Here is the caller graph for this function:

◆ printAttribute()

def analyze-benchmark.PrettyPrint.printAttribute (   self)

Definition at line 200 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.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().

200  def printAttribute(self):
201  self.printHeader()
202  ref_count = len(self.__attribute_ref)
203  while self.getRefElementsPerLine() < ref_count:
204  print("%10s" % "Queries", end="")
205  self.printLine(self.__label_name_ref)
206  self.printSolidLine("-")
207  print("%10s" % "Reference", end="")
208  self.printLine(self.__attribute_ref)
209  print("%10s" % "Sample", end="")
210  self.printLine(self.__attribute_sample)
211  print("%10s" % "Speedup", end="")
212  self.printLine(
213  compute_speedup(self.__attribute_ref, self.__attribute_sample)
214  )
215  self.printSolidLine("=")
216  self.__ref_line_count += 1
217  print("\n\n\n")
218 
219 
+ Here is the call graph for this function:

◆ printHeader()

def analyze-benchmark.PrettyPrint.printHeader (   self)

Definition at line 180 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().

180  def printHeader(self):
181  for h in self.__header_info:
182  print("\t" + h)
183  self.printSolidLine("=")
184 
+ 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 188 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().

188  def printLine(self, array):
189  begin = self.getRefElementsPerLine()
190  end = self.getRefElementsPerLine() + self.__num_items_per_line
191  for i in range(begin, min(end, len(self.__attribute_ref))):
192  if isinstance(array[i], float):
193  print("%10.2f" % (array[i]), end="")
194  elif isinstance(array[i], str):
195  print("%10s" % (array[i]), end="")
196  else:
197  assert False
198  print("")
199 
+ 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 174 of file analyze-benchmark.py.

References analyze-benchmark.PrettyPrint.__num_items_per_line.

Referenced by analyze-benchmark.PrettyPrint.printAttribute(), and analyze-benchmark.PrettyPrint.printHeader().

174  def printSolidLine(self, pattern):
175  for i in range(self.__num_items_per_line + 1):
176  for j in range(11):
177  print(pattern, end="")
178  print("")
179 
+ 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 157 of file analyze-benchmark.py.

Referenced by analyze-benchmark.PrettyPrint.printAttribute().

◆ __header_info

analyze-benchmark.PrettyPrint.__header_info
private

Definition at line 142 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 161 of file analyze-benchmark.py.


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