Skip to content

Add ResourceTimeRange. #352

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

crisl-ms
Copy link
Contributor

ResourceTimeRange

ResourceTimeRange is a new duration-like data type that is designed to compute accurately total resource usage when aggregated as Sum.

In particular, Sum aggregation of ResourceTimeRange values avoids both:

  • overestimation of total usage in the presence of nested activities on the same resource.
  • underestimation of total usage in the presence of activities running concurrently on different resources.

Differences from current Duration-like Data Types

Two other duration-like data types already exist in the Microsoft Performance Toolkit SDK, TimeStampDelta and TimeRange. They either overestimate or underestimate the total usage ResourceTimeRange computes, as follows:

  • TimeStampDelta values sum as the plain sum of durations, irrespective of potential nesting of the respective activities on the same resource. As such, they overestimate resource usage in the presence of nested activities on the same resource. However, TimeStampDelta correctly accounts for parallel resource usage in the presence of activities running concurrently on different resources.
  • TimeRange values sum as the total duration of the union of their time intervals, irrespective of potentially parallelism of the respective activities running on different resources. As such, they underestimate resource usage in the presence of activities running concurrently on different resources. However, TimeRange correctly eliminates resource usage duplication in the presence of nested activities on the same resource.

ResourceTimeRange combines the strengths of TimeStampDelta and TimeRange while eliminating their weaknesses for the use case of computing the total resource usage.

New Data Type Details

Technically, ResourceTimeRange contains both an int resource id and a TimeRange. The resource id interpretation can vary from column to column, so that different columns in the same or different tables could perform total resource usage computation on CPUs, disks, processes, threads, etc., depending on the corresponding resource affinity/interaction interpretation of the respective entities in the rows of the table.

Like TimeRange, ResourceTimeRange is compared and presented as a TimeStampDelta, offering an alternative Sum aggregation to TimeStampDelta's plain summing of durations.

ResourceTimeRange values sum as the sum of across resources of the total duration of the union of their time intervals on the same resource. As such, they behave like TimeRange values on the same resource and like TimeStampDelta values across different resources.

ResourceTimeRange values also aggregate as Min, Max, Count, Unique Count, similar to TimeRange values.

@crisl-ms crisl-ms force-pushed the user/crisl/add-ResourceTimeRange branch from f42e965 to d407d8a Compare September 11, 2024 19:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant