示例#1
0
 def test_average_and_variance(self):
     self.assertIsNone(average_and_variance())
     mean, var = average_and_variance(self.a, self.b)
     self.assertIsInstance(mean, CombinedTrace)
     self.assertIsInstance(var, CombinedTrace)
     self.assertEqual(len(mean.samples), 2)
     self.assertEqual(len(var.samples), 2)
     self.assertEqual(mean, average(self.a, self.b))
     self.assertEqual(var, variance(self.a, self.b))
示例#2
0
def main(profiler, operations, directory):
    traces = InspectorTraceSet.read("test/data/example.trs")
    with Profiler(profiler, directory,
                  f"combine_average_example_{operations}"):
        for _ in range(operations):
            average(*traces)
    with Profiler(profiler, directory,
                  f"combine_condavg_example_{operations}"):
        for _ in range(operations):
            conditional_average(*traces, condition=lambda trace: trace[0] > 0)
    with Profiler(profiler, directory,
                  f"combine_variance_example_{operations}"):
        for _ in range(operations):
            variance(*traces)
    with Profiler(profiler, directory, f"combine_stddev_example_{operations}"):
        for _ in range(operations):
            standard_deviation(*traces)
    with Profiler(profiler, directory, f"combine_add_example_{operations}"):
        for _ in range(operations):
            add(*traces)
    with Profiler(profiler, directory,
                  f"combine_subtract_example_{operations}"):
        for _ in range(operations):
            subtract(traces[0], traces[1])
示例#3
0
 def test_variance(self):
     self.assertIsNone(variance())
     result = variance(self.a, self.b)
     self.assertIsInstance(result, CombinedTrace)
     self.assertEqual(len(result.samples), 2)