-
Notifications
You must be signed in to change notification settings - Fork 3
Normalize CPU use graphs, improve load time #34
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
adadi-MS
wants to merge
5
commits into
main
Choose a base branch
from
user/adadi/idlesynth
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
610ddda
Normalize CPU use graphs, improve load time
adadi-MS aed2e07
Merge branch 'main' of https://github.com/microsoft/Microsoft-Perform…
adadi-MS 966266f
Handle nonexistent priority on ThreadStateEvent
adadi-MS 59a198d
Handle nonexistent summary on ThreadStateEvent
adadi-MS ab247bd
Update baselines
adadi-MS File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,42 @@ | ||
| // Copyright (c) Microsoft Corporation. | ||
| // Licensed under the MIT License. | ||
|
|
||
| using System; | ||
| using Microsoft.Performance.SDK; | ||
|
|
||
| namespace InstrumentsProcessor.Cookers | ||
| { | ||
| internal class IdleTimeTracker | ||
| { | ||
| private Timestamp[] CpuTimes = new Timestamp[10]; | ||
|
|
||
| public TimestampDelta Advance(int coreId, Timestamp nextStart, TimestampDelta duration) | ||
| { | ||
| TimestampDelta gap = TimestampDelta.Zero; | ||
|
|
||
| if (coreId >= 0) | ||
| { | ||
| if (CpuTimes.Length <= coreId) | ||
| { | ||
| Array.Resize(ref CpuTimes, coreId + 1); | ||
| } | ||
|
|
||
| Timestamp last = CpuTimes[coreId]; | ||
| if (last != Timestamp.Zero) | ||
| { | ||
| // ThreadState should not, but TimeProfile does have overlapping events | ||
| // so we cannot in general make this assertion. | ||
| // Debug.Assert(nextStart >= last, "Overlapping threads on same processor"); | ||
| if (nextStart > last) | ||
| { | ||
| gap = nextStart - last; | ||
| } | ||
| } | ||
|
|
||
| CpuTimes[coreId] = nextStart + duration; | ||
| } | ||
|
|
||
| return gap; | ||
| } | ||
bgn64 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| } | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,34 @@ | ||
| // Copyright (c) Microsoft Corporation. | ||
| // Licensed under the MIT License. | ||
|
|
||
| using System; | ||
| using System.Reflection; | ||
| using System.Xml; | ||
|
|
||
| namespace InstrumentsProcessor.Parsing.DataModels | ||
| { | ||
| public class CPU : IPropertyDeserializer | ||
| { | ||
| [CustomDeserialization] | ||
| public int CoreId { get; private set; } | ||
|
|
||
| [CustomDeserialization] | ||
| public string Core { get; private set; } | ||
|
|
||
| public object DeserializeProperty(XmlNode node, XmlParsingContext context, PropertyInfo property) | ||
| { | ||
| if (property.Name == "CoreId") | ||
| { | ||
| return int.Parse(node.InnerText); | ||
bgn64 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| } | ||
| else if (property.Name == "Core") | ||
| { | ||
| return node.Attributes["fmt"]?.Value; | ||
| } | ||
| else | ||
| { | ||
| throw new InvalidOperationException(); | ||
| } | ||
| } | ||
| } | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,11 +1,44 @@ | ||
| // Copyright (c) Microsoft Corporation. | ||
| // Licensed under the MIT License. | ||
|
|
||
| using System; | ||
| using System.Reflection; | ||
| using System.Xml; | ||
|
|
||
| namespace InstrumentsProcessor.Parsing.DataModels | ||
| { | ||
| public class Thread | ||
| public class Thread : IPropertyDeserializer | ||
| { | ||
| public Integer ThreadId { get; private set; } | ||
| public Process Process { get; private set; } | ||
|
|
||
| [CustomDeserialization] | ||
| public string ThreadName { get; private set; } | ||
|
|
||
| public object DeserializeProperty(XmlNode node, XmlParsingContext context, PropertyInfo property) | ||
| { | ||
| if (property.Name == "ThreadName") | ||
| { | ||
| return node.Attributes["fmt"]?.Value ?? string.Empty; | ||
| } | ||
| else | ||
| { | ||
| throw new InvalidOperationException(); | ||
| } | ||
| } | ||
|
|
||
| public System.UInt64 ThreadUniqueId() | ||
| { | ||
| System.UInt64 pid = (UInt32)Process.ProcessId.Value; | ||
| UInt32 tid = (UInt32)ThreadId.Value; | ||
bgn64 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| return (pid << 32) | tid; | ||
| } | ||
|
|
||
| public static readonly Thread IdleThread = new Thread | ||
| { | ||
| ThreadId = new Integer(-1), | ||
| Process = Process.IdleProcess, | ||
| ThreadName = "Idle thread" | ||
| }; | ||
| } | ||
| } | ||
| } | ||
Oops, something went wrong.
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.