Index: tools/ignition/bytecode_dispatches_report_test.py |
diff --git a/tools/ignition/bytecode_dispatches_report_test.py b/tools/ignition/bytecode_dispatches_report_test.py |
index 523dac2960d8da5e0d2ca9f31288e6201a80b041..da524a7fa3d948f98e250cd0c2d71e79791095ea 100644 |
--- a/tools/ignition/bytecode_dispatches_report_test.py |
+++ b/tools/ignition/bytecode_dispatches_report_test.py |
@@ -9,9 +9,9 @@ import unittest |
class BytecodeDispatchesReportTest(unittest.TestCase): |
def test_find_top_counters(self): |
top_counters = bdr.find_top_bytecode_dispatch_pairs({ |
- "a": {"a": 10, "b": 8, "c": 99}, |
- "b": {"a": 1, "b": 4, "c": 1}, |
- "c": {"a": 42, "b": 3, "c": 7}}, 5) |
+ "a": {"a": (10, 0.3), "b": (8, 0.3), "c": (99, 0.3)}, |
+ "b": {"a": (1, 0.3), "b": (4, 0.3), "c": (1, 0.3)}, |
+ "c": {"a": (42, 0.3), "b": (3, 0.3), "c": (7, 0.3)}}, 5) |
self.assertListEqual(top_counters, [ |
('a', 'c', 99), |
('c', 'a', 42), |
@@ -21,9 +21,9 @@ class BytecodeDispatchesReportTest(unittest.TestCase): |
def test_build_counters_matrix(self): |
counters_matrix, xlabels, ylabels = bdr.build_counters_matrix({ |
- "a": {"a": 10, "b": 8, "c": 7}, |
- "b": {"a": 1, "c": 4}, |
- "c": {"a": 42, "b": 12, "c": 99}}) |
+ "a": {"a": (10, 0.3), "b": (8, 0.3), "c": (7, 0.3)}, |
+ "b": {"a": (1, 0.5), "c": (4, 0.5)}, |
+ "c": {"a": (42, 0.3), "b": (12, 0.3), "c": (99, 0.3)}}) |
self.assertTrue((counters_matrix == [[42, 12, 99], |
[ 1, 0, 4], |
[10, 8, 7]]).all()) |
@@ -32,9 +32,9 @@ class BytecodeDispatchesReportTest(unittest.TestCase): |
def test_find_top_bytecodes(self): |
top_dispatch_sources = bdr.find_top_bytecodes({ |
- "a": {"a": 10, "b": 8, "c": 7}, |
- "b": {"a": 1, "c": 4}, |
- "c": {"a": 42, "b": 12, "c": 99} |
+ 'a': 25, |
+ 'b': 5, |
+ 'c': 153 |
}) |
self.assertListEqual(top_dispatch_sources, [ |
('c', 153), |
@@ -43,12 +43,18 @@ class BytecodeDispatchesReportTest(unittest.TestCase): |
]) |
def test_find_top_dispatch_sources(self): |
- top_dispatch_sources = bdr.find_top_dispatch_sources({ |
- "a": {"a": 10, "b": 8, "c": 7}, |
- "b": {"a": 1, "c": 4}, |
- "c": {"a": 42, "b": 12, "c": 99} |
- }, "b", 10) |
+ d = { |
+ "a": {"a": (10, 0.3), "b": (8, 0.4), "c": (7, 0.3)}, |
+ "b": {"a": (1, 0.5), "c": (4, 0.5)}, |
+ "c": {"a": (42, 0.3), "b": (12, 0.3), "c": (99, 0.3)} |
+ } |
+ top_dispatch_sources = bdr.find_top_dispatch_sources(d, "b", 10, False) |
self.assertListEqual(top_dispatch_sources, [ |
- ("c", 12), |
- ("a", 8) |
+ ("c", (12, 0.3)), |
+ ("a", (8, 0.4)) |
+ ]) |
+ top_dispatch_sources = bdr.find_top_dispatch_sources(d, "b", 10, True) |
+ self.assertListEqual(top_dispatch_sources, [ |
+ ("a", (8, 0.4)), |
+ ("c", (12, 0.3)) |
]) |