-
-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add Inspect functionality to analyze ETW trace files and return infor…
…mation about processes
- Loading branch information
Showing
4 changed files
with
129 additions
and
23 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
using System.Text.Encodings.Web; | ||
using System.Text.Json; | ||
using System.Text.Json.Serialization; | ||
|
||
namespace Ultra.Core | ||
{ | ||
internal readonly struct InspectProcessInfo(string name, int pid, string commandLine, int events) | ||
{ | ||
public string Name => name; | ||
public int Pid => pid; | ||
public string CommandLine => commandLine; | ||
public int Events => events; | ||
} | ||
|
||
internal class InspectOutput(string operatingSystem, int totalEvents, TimeSpan duration) | ||
{ | ||
public string OperatingSystem => operatingSystem; | ||
public int TotalEvents => totalEvents; | ||
public TimeSpan Duration => duration; | ||
public List<InspectProcessInfo> Processes { get; } = [ ]; | ||
} | ||
|
||
[JsonSerializable(typeof(InspectOutput))] | ||
internal partial class CommandInputsOutputsJsonSerializerContext : JsonSerializerContext | ||
{ | ||
static CommandInputsOutputsJsonSerializerContext() | ||
{ | ||
// Replace context with new options which are more human-friendly for text output | ||
var options = new JsonSerializerOptions() | ||
{ | ||
Encoder = JavaScriptEncoder.UnsafeRelaxedJsonEscaping, | ||
WriteIndented = true | ||
}; | ||
|
||
var context = new CommandInputsOutputsJsonSerializerContext(options); | ||
Default = context; | ||
} | ||
} | ||
} |
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
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