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.
ResourceTimeRangeResourceTimeRangeis a new duration-like data type that is designed to compute accurately total resource usage when aggregated asSum.In particular,
Sumaggregation ofResourceTimeRangevalues avoids both:Differences from current Duration-like Data Types
Two other duration-like data types already exist in the Microsoft Performance Toolkit SDK,
TimeStampDeltaandTimeRange. They either overestimate or underestimate the total usageResourceTimeRangecomputes, as follows:TimeStampDeltavalues 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,TimeStampDeltacorrectly accounts for parallel resource usage in the presence of activities running concurrently on different resources.TimeRangevalues 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,TimeRangecorrectly eliminates resource usage duplication in the presence of nested activities on the same resource.ResourceTimeRangecombines the strengths ofTimeStampDeltaandTimeRangewhile eliminating their weaknesses for the use case of computing the total resource usage.New Data Type Details
Technically,
ResourceTimeRangecontains both anintresource 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,ResourceTimeRangeis compared and presented as aTimeStampDelta, offering an alternativeSumaggregation toTimeStampDelta's plain summing of durations.ResourceTimeRangevalues 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 likeTimeRangevalues on the same resource and likeTimeStampDeltavalues across different resources.ResourceTimeRangevalues also aggregate asMin,Max,Count,Unique Count, similar toTimeRangevalues.