Add ResourceTimeRange. #352
Open
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
ResourceTimeRange
ResourceTimeRange
is a new duration-like data type that is designed to compute accurately total resource usage when aggregated asSum
.In particular,
Sum
aggregation ofResourceTimeRange
values avoids both:Differences from current Duration-like Data Types
Two other duration-like data types already exist in the Microsoft Performance Toolkit SDK,
TimeStampDelta
andTimeRange
. They either overestimate or underestimate the total usageResourceTimeRange
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 ofTimeStampDelta
andTimeRange
while eliminating their weaknesses for the use case of computing the total resource usage.New Data Type Details
Technically,
ResourceTimeRange
contains both anint
resource id and aTimeRange
. 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 aTimeStampDelta
, offering an alternativeSum
aggregation toTimeStampDelta
'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 likeTimeRange
values on the same resource and likeTimeStampDelta
values across different resources.ResourceTimeRange
values also aggregate asMin
,Max
,Count
,Unique Count
, similar toTimeRange
values.