sampro/sampro.py
def flame_map(self):
        '''
        return sampled stacks in form suitable for inclusion in a
        flame graph (https://github.com/brendangregg/FlameGraph)
        '''
        flame_map = {}
        _, stack_counts = self.live_data_copy()
        for stack, count in stack_counts.items():
            root = stack[-2].co_name
            stack_elements = []
            for i in range(len(stack)):
                if type(stack[i]) in (int, long):
                    continue
                code = stack[i]
                stack_elements.append("{0}`{1}`{2}".format(
                    root, code.co_filename, code.co_name))
            flame_key = ';'.join(stack_elements)
            flame_map.setdefault(flame_key, 0)
            flame_map[flame_key] += count
        return flame_map
def flame_map(self):
        '''
        return sampled stacks in form suitable for inclusion in a
        flame graph (https://github.com/brendangregg/FlameGraph)
        '''
        flame_map = {}
        _, stack_counts = self.live_data_copy()
        for stack, count in stack_counts.items():
            root = stack[-2].co_name
            stack_elements = []
            for i in range(len(stack)):
                if type(stack[i]) in (int, long):
                    continue
                code = stack[i]
                stack_elements.append("{0}`{1}`{2}".format(
                    root, code.co_filename, code.co_name))
            flame_key = ';'.join(stack_elements)
            flame_map.setdefault(flame_key, 0)
            flame_map[flame_key] += count
        return flame_map
return sampled stacks in form suitable for inclusion in a
        flame graph (https://github.com/brendangregg/FlameGraph)