-
Notifications
You must be signed in to change notification settings - Fork 25
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add BuildJobResult.PerformanceDetails
- Loading branch information
Showing
5 changed files
with
84 additions
and
2 deletions.
There are no files selected for viewing
This file contains 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 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 @@ | ||
using System.Collections; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Text; | ||
|
||
namespace Imageflow.Fluent | ||
{ | ||
public class PerformanceDetails | ||
{ | ||
internal PerformanceDetails(dynamic perf) | ||
{ | ||
foreach (var f in perf.frames) | ||
{ | ||
frames.Add(new PerformanceDetailsFrame(f)); | ||
} | ||
} | ||
private List<PerformanceDetailsFrame> frames = new List<PerformanceDetailsFrame>(); | ||
public ICollection<PerformanceDetailsFrame> Frames => frames; | ||
|
||
public string GetFirstFrameSummary() | ||
{ | ||
var sb = new StringBuilder(); | ||
if (Frames.Count > 1) | ||
{ | ||
sb.Append($"First of {Frames.Count} frames: "); | ||
}else if (Frames.Count == 0) | ||
{ | ||
sb.Append("No frames found"); | ||
} | ||
|
||
foreach (var n in Frames.First().Nodes) | ||
{ | ||
sb.Append(n.Name); | ||
sb.Append("("); | ||
sb.Append((n.WallMicroseconds / 1000.0).ToString("0.####")); | ||
sb.Append("ms) "); | ||
} | ||
|
||
return sb.ToString(); | ||
} | ||
} | ||
} |
This file contains 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,23 @@ | ||
using System.Collections.Generic; | ||
|
||
namespace Imageflow.Fluent | ||
{ | ||
public class PerformanceDetailsFrame | ||
{ | ||
internal PerformanceDetailsFrame(dynamic frame) | ||
{ | ||
foreach (var n in frame.nodes) | ||
{ | ||
nodes.Add(new PerformanceDetailsNode() | ||
{ | ||
Name = n.name, | ||
WallMicroseconds = n.wall_microseconds | ||
}); | ||
} | ||
} | ||
|
||
private List<PerformanceDetailsNode> nodes = new List<PerformanceDetailsNode>(); | ||
|
||
public ICollection<PerformanceDetailsNode> Nodes => nodes; | ||
} | ||
} |
This file contains 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,9 @@ | ||
namespace Imageflow.Fluent | ||
{ | ||
public struct PerformanceDetailsNode | ||
{ | ||
|
||
public string Name { get; internal set; } | ||
public long WallMicroseconds { get; internal set; } | ||
} | ||
} |
This file contains 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