BlameReport

Module for BlameReport, a collection of blame interactions.

class varats.data.reports.blame_report.BlameInstInteractions(base_hash, interacting_hashes, amount)[source]

Bases: object

An interaction between a base commit, attached to an instruction, and other commits.

For the blame analysis, these commits stem from data flows into the instruction.

static create_blame_inst_interactions(raw_inst_entry)[source]

Creates a BlameInstInteractions entry from the corresponding yaml document section.

Return type

BlameInstInteractions

property base_commit: varats.utils.git_util.CommitRepoPair

Base hash of the analyzed instruction.

Return type

CommitRepoPair

property interacting_commits: List[varats.utils.git_util.CommitRepoPair]

List of hashes that interact with the base.

Return type

List[CommitRepoPair]

property amount: int

Number of same interactions found in this function.

Return type

int

class varats.data.reports.blame_report.BlameResultFunctionEntry(name, demangled_name, blame_insts, num_instructions)[source]

Bases: object

Collection of all interactions for a specific function.

static create_blame_result_function_entry(name, raw_function_entry)[source]

Creates a BlameResultFunctionEntry from the corresponding yaml document section.

Return type

BlameResultFunctionEntry

property name: str

Name of the function.

The name is manged for C++ code, either with the itanium or windows mangling schema.

Return type

str

property demangled_name: str

Demangled name of the function.

Return type

str

property num_instructions: int

Number of instructions in this function.

Return type

int

property interactions: List[varats.data.reports.blame_report.BlameInstInteractions]

List of found instruction blame-interactions.

Return type

List[BlameInstInteractions]

class varats.data.reports.blame_report.BlameReportMetaData(num_functions, num_instructions)[source]

Bases: object

Provides extra meta data about llvm::Module, which was analyzed to generate this BlameReport.

property num_functions: int

Number of functions in the analyzed llvm::Module.

Return type

int

property num_instructions: int

Number of instructions processed in the analyzed llvm::Module.

Return type

int

static create_blame_report_meta_data(raw_document)[source]

Creates BlameReportMetaData from the corresponding yaml document.

Return type

BlameReportMetaData

class varats.data.reports.blame_report.BlameReport(path)[source]

Bases: varats.report.report.BaseReport

Full blame report containing all blame interactions.

SHORTHAND = 'BR'
FILE_TYPE = 'yaml'
get_blame_result_function_entry(mangled_function_name)[source]

Get the result entry for a specific function.

Parameters

mangled_function_name (str) – mangled name of the function to look up

Return type

BlameResultFunctionEntry

property function_entries: ValuesView[varats.data.reports.blame_report.BlameResultFunctionEntry]

Iterate over all function entries.

Return type

ValuesView[BlameResultFunctionEntry]

property head_commit: str

The current HEAD commit under which this CommitReport was created.

Return type

str

property meta_data: varats.data.reports.blame_report.BlameReportMetaData

Access the meta data that was gathered with the BlameReport.

Return type

BlameReportMetaData

static get_file_name(project_name, binary_name, project_version, project_uuid, extension_type, file_ext='yaml')[source]

Generates a filename for a commit report with ‘yaml’ as file extension.

Parameters
  • project_name (str) – name of the project for which the report was generated

  • binary_name (str) – name of the binary for which the report was generated

  • project_version (str) – version of the analyzed project, i.e., commit hash

  • project_uuid (str) – benchbuild uuid for the experiment run

  • extension_type (FileStatusExtension) – to specify the status of the generated report

  • file_ext (str) – file extension of the report file

Return type

str

Returns

name for the report file that can later be uniquly identified

REPORT_TYPES: Dict[str, varats.report.report.MetaReport] = {'BlameReport': <class 'varats.data.reports.blame_report.BlameReport'>, 'BlameVerifierReportNoOpt': <class 'varats.data.reports.blame_verifier_report.BlameVerifierReportNoOpt'>, 'BlameVerifierReportNoOptTBAA': <class 'varats.data.reports.blame_verifier_report.BlameVerifierReportNoOptTBAA'>, 'BlameVerifierReportOpt': <class 'varats.data.reports.blame_verifier_report.BlameVerifierReportOpt'>, 'CommitReport': <class 'varats.data.reports.commit_report.CommitReport'>, 'EmptyReport': <class 'varats.data.reports.empty_report.EmptyReport'>, 'SZZReport': <class 'varats.data.reports.szz_report.SZZReport'>, 'SZZUnleashedReport': <class 'varats.data.reports.szz_report.SZZUnleashedReport'>}
class varats.data.reports.blame_report.BlameReportDiff(base_report, prev_report)[source]

Bases: object

Diff class that contains all interactions that changed between two report revisions.

property base_head_commit: str
Return type

str

property prev_head_commit: str
Return type

str

property function_entries: ValuesView[varats.data.reports.blame_report.BlameResultFunctionEntry]

Iterate over all function entries in the diff.

Return type

ValuesView[BlameResultFunctionEntry]

get_blame_result_function_entry(mangled_function_name)[source]

Get the result entry for a specific function in the diff.

Parameters

mangled_function_name (str) – mangled name of the function to look up

Return type

BlameResultFunctionEntry

has_function(mangled_function_name)[source]
Return type

bool

varats.data.reports.blame_report.count_interactions(report)[source]

Counts the number of interactions.

Parameters

report (Union[BlameReport, BlameReportDiff]) – the blame report or diff

Return type

int

Returns

the number of interactions in this report or diff

varats.data.reports.blame_report.count_interacting_commits(report)[source]

Counts the number of unique interacting commits.

Parameters

report (Union[BlameReport, BlameReportDiff]) – the blame report or diff

Return type

int

Returns

the number unique interacting commits in this report or diff

varats.data.reports.blame_report.count_interacting_authors(report, commit_lookup)[source]

Counts the number of unique interacting authors.

Parameters
  • report (Union[BlameReport, BlameReportDiff]) – the blame report or diff

  • commit_lookup (Callable[[str, str], Commit]) – function to look up commits

Return type

int

Returns

the number unique interacting authors in this report or diff

varats.data.reports.blame_report.generate_degree_tuples(report)[source]

Generates a list of tuples (degree, amount) where degree is the interaction degree of a blame interaction, e.g., the number of incoming interactions, and amount is the number of times an interaction with this degree was found in the report.

Parameters

report (Union[BlameReport, BlameReportDiff]) – the blame report

Return type

List[Tuple[int, int]]

Returns

list of tuples (degree, amount)

varats.data.reports.blame_report.gen_base_to_inter_commit_repo_pair_mapping(report)[source]

Maps the base CommitRepoPair of a blame interaction to each distinct interacting CommitRepoPair, which maps to the amount of the interaction.

Parameters

report (Union[BlameReport, BlameReportDiff]) – blame report

Return type

Dict[CommitRepoPair, Dict[CommitRepoPair, int]]

Returns

A mapping from base CommitRepoPairs to a mapping of the corresponding interacting CommitRepoPairs to their amount.

varats.data.reports.blame_report.generate_lib_dependent_degrees(report)[source]
Parameters

report (Union[BlameReport, BlameReportDiff]) – blame report

Return type

Dict[str, Dict[str, List[Tuple[int, int]]]]

Returns

Map of tuples (degree, amount) categorised by their corresponding library name to their corresponding base library name.

varats.data.reports.blame_report.generate_author_degree_tuples(report, commit_lookup)[source]

Generates a list of tuples (author_degree, amount) where author_degree is the number of unique authors for all blame interaction, e.g., the number of unique authors of incoming interactions, and amount is the number of times an interaction with this degree was found in the report.

Parameters
  • report (Union[BlameReport, BlameReportDiff]) – the blame report

  • commit_lookup (Callable[[str, str], Commit]) – function to look up commits

Return type

List[Tuple[int, int]]

Returns

list of tuples (author_degree, amount)

varats.data.reports.blame_report.generate_time_delta_distribution_tuples(report, commit_lookup, bucket_size, aggregate_function)[source]

Generates a list of tuples that represent the distribution of time delta interactions. The first value in the tuple represents the degree of the time delta, bucketed according to bucket_size. The second value is the time delta, aggregated over all interacting commits by the passed aggregate_function.

Parameters
  • report (Union[BlameReport, BlameReportDiff]) – to analyze

  • commit_lookup (Callable[[str, str], Commit]) – function to look up commits

  • bucket_size (int) – size of a time bucket in days

  • aggregate_function (Callable[[Sequence[Union[int, float]]], Union[int, float]]) – to aggregate the delta values of all interacting commits

Return type

List[Tuple[int, int]]

Returns

list of (degree, amount) tuples

varats.data.reports.blame_report.generate_avg_time_distribution_tuples(report, commit_lookup, bucket_size)[source]

Generates a list of tuples that represent the distribution of average time delta interactions. The first value in the tuple represents the degree of the time delta, bucketed according to bucket_size. The second value is the time delta, averaged over all interacting commits.

Parameters
  • report (Union[BlameReport, BlameReportDiff]) – to analyze

  • commit_lookup (Callable[[str, str], Commit]) – function to look up commits

  • bucket_size (int) – size of a time bucket in days

Return type

List[Tuple[int, int]]

Returns

list of (degree, avg_time) tuples

varats.data.reports.blame_report.generate_max_time_distribution_tuples(report, commit_lookup, bucket_size)[source]

Generates a list of tuples that represent the distribution of maximal time delta interactions. The first value in the tuple represents the degree of the time delta, bucketed according to bucket_size. The second value is the max time delta, i.e., the maximal time distance between the base commit and one of the all interacting commits.

Parameters
  • report (Union[BlameReport, BlameReportDiff]) – to analyze

  • commit_lookup (Callable[[str, str], Commit]) – function to look up commits

  • bucket_size (int) – size of a time bucket in days

Return type

List[Tuple[int, int]]

Returns

list of (degree, max_time) tuples

varats.data.reports.blame_report.generate_in_head_interactions(report)[source]

Generate a list of interactions where the base_hash of the interaction is the same as the HEAD of the report.

Parameters

report (BlameReport) – BlameReport to get the interactions from

Return type

List[BlameInstInteractions]

varats.data.reports.blame_report.generate_out_head_interactions(report)[source]

Generate a list of interactions where one of the interacting hashes is the same as the HEAD of the report.

Parameters

report (BlameReport) – BlameReport to get the interactions from

Return type

List[BlameInstInteractions]