DynamoRIO / dynamorio

Dynamic Instrumentation Tool Platform
Other
2.63k stars 557 forks source link

i#6643: Add finalize_interval_snapshots API to analysis_tool_t #6664

Closed abhinav92003 closed 7 months ago

abhinav92003 commented 7 months ago

Adds a new finalize_interval_snapshots API to analysis_tool_t. This is invoked with the list of shard-local interval state snapshots for each shard separately in the parallel mode, or the whole-trace ones in serial mode. This allows the tool the opportunity to make any required holistic adjustments to the snapshots since now all of the snapshots can be observed together; e.g., computing diffs with the prior snapshot. This is invoked before the shard-local snapshots are possibly combined to create whole-trace snapshots, and before the snapshots are passed to print_interval_results.

Adds unit tests for the new API to the existing tool.drcacheoff.trace_interval_analysis_unit_tests tests.

Refactors some existing code to accumulate the interval snapshots in an std::vector instead of an std::queue. This adds some more complexity to the merge_shard_interval_results implementation, but is better because now we have more usages where an std::vector is needed (and we want to avoid a back-and-forth conversion between a queue and a vector).

Augments various documentation to provide more details about intended usages of the interval APIs. Notably: documented the new finalize_interval_snapshots API, and that modifications made after the combine_interval_snapshots API has been invoked do not have any effect).

Issue: #6643, #6020

abhinav92003 commented 7 months ago

Xref #6665 that marks the data members of interval_state_snapshot_t as private. This would obviate the need to document warnings to prevent the user tools from modifying them.