def testRepeatedFunction(self): """Tests accumulation of samples of the same function over many files.""" collapser = StackCollapser('./samples.collapsed') collapser.read_dtrace_logs('./test_data/repeated/') self.assertEquals(collapser.samples, [{ 'frames': ['foo', 'bar', 'baz'], 'weight': 24 }])
def testTrimFunctionOffset(self): """Tests removal of the function offset markers in the DTrace format.""" collapser = StackCollapser('./samples.collapsed') collapser.read_dtrace_logs('./test_data/with_offset/') self.assertEquals(collapser.samples, [{ 'frames': ['foo', 'bar', 'baz'], 'weight': 12 }])
def testValidBlock(self): """Tests basic parsing of the DTrace format.""" collapser = StackCollapser('./samples.collapsed') collapser.read_dtrace_logs('./test_data/valid/') self.assertEquals(collapser.samples, [{ 'frames': ['foo', 'bar', 'baz'], 'weight': 12 }])
def testEmpty(self): """Tests that a directory with no valid stacks triggers a failure.""" with self.assertRaises(SystemExit): collapser = StackCollapser('./samples.collapsed') collapser.read_dtrace_logs('./test_data/empty/')