コード例 #1
0
    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
        }])
コード例 #2
0
    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
        }])
コード例 #3
0
    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
        }])
コード例 #4
0
    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/')