How to use the pprofile._FileTiming function in pprofile

To help you get started, we’ve selected a few pprofile examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github vpelletier / pprofile / pprofile.py View on Github external
by_global_dict[
                    id(file_timing.global_dict)
                ].append(
                    file_timing,
                )
        # Resolve name conflicts.
        global_to_named_dict = {}
        for global_dict_id, file_timing_list in by_global_dict.iteritems():
            file_timing = file_timing_list[0]
            name = file_timing.filename
            if name in merged_file_dict:
                counter = count()
                base_name = name
                while name in merged_file_dict:
                    name = base_name + '_%i' % next(counter)
            global_to_named_dict[global_dict_id] = merged_file_dict[name] = FileTiming(
                name,
                file_timing.global_dict,
                file_timing.profiler, # Note: should be self
            )
        # Add all file timings from one module together under its
        # deduplicated name. This needs to happen after all names
        # are generated  and all empty file timings are created so
        # call events cross-references can be remapped.
        for merged_file_timing in merged_file_dict.itervalues():
            line_dict = merged_file_timing.line_dict
            for file_timing in by_global_dict[id(merged_file_timing.global_dict)]:
                for line, other_code_dict in file_timing.line_dict.iteritems():
                    code_dict = line_dict[line]
                    for code, (
                        other_hits,
                        other_duration,