OmniSciDB  c07336695a
analyze-benchmark.BenchAnalyzer Class Reference

Public Member Functions

def __init__ (self, ref, sample, attribute)
 
def collectMissingQueries (self)
 
def printHeader (self)
 
def findAnomaliesRatio (self, epsilon)
 

Private Attributes

 __header_info
 
 __label_name_ref
 
 __label_name_sample
 
 __missing_queries_ref
 
 __missing_queries_sample
 
 __attribute_ref
 
 __attribute_sample
 

Detailed Description

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

Constructor & Destructor Documentation

◆ __init__()

def analyze-benchmark.BenchAnalyzer.__init__ (   self,
  ref,
  sample,
  attribute 
)

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

62  def __init__(self, ref, sample, attribute):
63  assert isinstance(ref, BenchmarkLoader)
64  assert isinstance(sample, BenchmarkLoader)
65  self.__header_info = [ref.getRunTableName(), attribute]
66  self.__label_name_ref = ref.fetchQueryNames()
67  self.__label_name_sample = sample.fetchQueryNames()
68  self.__missing_queries_ref = []
69  self.__missing_queries_sample = []
70  self.collectMissingQueries()
71  assert self.__label_name_ref == self.__label_name_sample
72  self.__attribute_ref = ref.fetchAttribute(
73  attribute, self.__label_name_ref
74  )
75  self.__attribute_sample = sample.fetchAttribute(
76  attribute, self.__label_name_sample
77  )
78 

Member Function Documentation

◆ collectMissingQueries()

def analyze-benchmark.BenchAnalyzer.collectMissingQueries (   self)

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

References analyze-benchmark.BenchAnalyzer.__label_name_ref, analyze-benchmark.BenchAnalyzer.__label_name_sample, analyze-benchmark.BenchAnalyzer.__missing_queries_ref, analyze-benchmark.BenchAnalyzer.__missing_queries_sample, and File_Namespace.append().

80  def collectMissingQueries(self):
81  for query in self.__label_name_ref:
82  if query not in self.__label_name_sample:
83  self.__missing_queries_sample.append(query)
84  self.__label_name_ref.remove(query)
85  for query in self.__label_name_sample:
86  if query not in self.__label_name_ref:
87  self.__missing_queries_ref.append(query)
88  self.__label_name_sample.remove(query)
89 
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:

◆ findAnomaliesRatio()

def analyze-benchmark.BenchAnalyzer.findAnomaliesRatio (   self,
  epsilon 
)

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

References analyze-benchmark.BenchAnalyzer.__attribute_ref, analyze-benchmark.BenchAnalyzer.__attribute_sample, analyze-benchmark.BenchAnalyzer.__label_name_ref, analyze-benchmark.BenchAnalyzer.__missing_queries_ref, analyze-benchmark.BenchAnalyzer.__missing_queries_sample, analyze-benchmark.compute_speedup(), and analyze-benchmark.BenchAnalyzer.printHeader().

94  def findAnomaliesRatio(self, epsilon):
95  found = False
96  speedup = compute_speedup(
97  self.__attribute_ref, self.__attribute_sample
98  )
99  print("Differences outside of %2.0f%%: " % (epsilon * 100), end="")
100  self.printHeader()
101  for i in range(len(speedup)):
102  if abs(speedup[i] - 1.0) > epsilon:
103  if found == False:
104  found = True
105  print(
106  "\n%s: reference = %.2f ms, sample = %.2f ms, speedup = %.2fx"
107  % (
108  self.__label_name_ref[i],
109  self.__attribute_ref[i],
110  self.__attribute_sample[i],
111  speedup[i],
112  ),
113  end="",
114  )
115  if found == False:
116  print(": None", end="")
117  if self.__missing_queries_ref:
118  print("\n*** Missing queries from reference: ", end="")
119  for query in self.__missing_queries_ref:
120  print(query + " ", end="")
121  if self.__missing_queries_sample:
122  print("\n*** Missing queries from sample: ", end="")
123  for query in self.__missing_queries_sample:
124  print(query + " ", end="")
125  print(
126  "\n======================================================================="
127  )
128 
129 
+ Here is the call graph for this function:

◆ printHeader()

def analyze-benchmark.BenchAnalyzer.printHeader (   self)

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

References analyze-benchmark.BenchAnalyzer.__header_info.

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

90  def printHeader(self):
91  for h in self.__header_info:
92  print(" " + h, end="")
93 
+ Here is the caller graph for this function:

Member Data Documentation

◆ __attribute_ref

analyze-benchmark.BenchAnalyzer.__attribute_ref
private

◆ __attribute_sample

analyze-benchmark.BenchAnalyzer.__attribute_sample
private

◆ __header_info

analyze-benchmark.BenchAnalyzer.__header_info
private

◆ __label_name_ref

◆ __label_name_sample

analyze-benchmark.BenchAnalyzer.__label_name_sample
private

◆ __missing_queries_ref

◆ __missing_queries_sample


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