Class DiagnosticsService
- Namespace
- SharpConsoleUI.Plugins.DeveloperTools
- Assembly
- SharpConsoleUI.dll
Diagnostics service providing system performance metrics. Implements IPluginService for reflection-free invocation from external DLLs.
public class DiagnosticsService : IPluginService
- Inheritance
-
DiagnosticsService
- Implements
- Inherited Members
Constructors
DiagnosticsService()
Initializes a new instance of the DiagnosticsService class.
public DiagnosticsService()
Properties
Description
Gets a human-readable description of what this service provides.
public string Description { get; }
Property Value
ServiceName
Gets the unique name of this service. This is used to retrieve the service from the plugin system.
public string ServiceName { get; }
Property Value
Examples
"Diagnostics", "Logger", "Authentication"
Methods
Execute(string, Dictionary<string, object>?)
Executes a named operation with optional parameters.
public object? Execute(string operationName, Dictionary<string, object>? parameters = null)
Parameters
operationNamestringThe name of the operation to execute
parametersDictionary<string, object>Optional dictionary of parameter name/value pairs
Returns
- object
The result of the operation, or null if the operation returns void
Remarks
Parameter values should match the types declared in the operation metadata. The caller is responsible for casting the return value to the expected type based on the operation metadata.
Exceptions
- InvalidOperationException
Thrown if the operation name is unknown or parameters are invalid
ForceGC()
Forces a garbage collection. Use sparingly.
public void ForceGC()
GetAvailableOperations()
Gets the list of operations this service supports, with full metadata about parameters, return types, and descriptions. This enables runtime discovery and self-documenting service interfaces.
public IReadOnlyList<ServiceOperation> GetAvailableOperations()
Returns
- IReadOnlyList<ServiceOperation>
A read-only list of operation metadata
GetDiagnosticsReport()
Gets a formatted diagnostics report with all metrics.
public string GetDiagnosticsReport()
Returns
GetGCGen0Count()
Gets the current GC generation 0 collection count.
public int GetGCGen0Count()
Returns
GetGCGen1Count()
Gets the current GC generation 1 collection count.
public int GetGCGen1Count()
Returns
GetGCGen2Count()
Gets the current GC generation 2 collection count.
public int GetGCGen2Count()
Returns
GetGCHeapSize()
Gets the current GC heap size in bytes.
public long GetGCHeapSize()
Returns
GetMemoryUsage()
public long GetMemoryUsage()
Returns
GetUptime()
Gets the uptime of the window system since initialization.
public TimeSpan GetUptime()
Returns
GetWindowCount()
Gets the number of windows currently managed by the window system.
public int GetWindowCount()