Class ProcessUtils
Provides utility methods for gathering process-related information and formatting memory sizes.
Inherited Members
Namespace: TriLibCore.Utils
Assembly: TriLibCore.dll
Syntax
public static class ProcessUtils
Methods
GetProcessData(out double, out long)
Obtains the total CPU time (in milliseconds) and memory usage (in bytes) for the current process.
Declaration
public static void GetProcessData(out double elapsedTime, out long usedMemory)
Parameters
| Type | Name | Description |
|---|---|---|
| double | elapsedTime | When this method returns, contains the total CPU time, in milliseconds, that the process has used. This value comes from TotalProcessorTime. |
| long | usedMemory | When this method returns, contains the total allocated memory, in bytes, as reported by GetTotalMemory(bool). |
SizeSuffix(long, int)
Formats a byte value into a human-readable string using common size suffixes (e.g., KB, MB, GB).
Declaration
public static string SizeSuffix(long value, int decimalPlaces = 1)
Parameters
| Type | Name | Description |
|---|---|---|
| long | value | The size, in bytes, to be formatted. |
| int | decimalPlaces | The number of decimal places to include in the formatted output.
The default value is |
Returns
| Type | Description |
|---|---|
| string | A string representation of |
Exceptions
| Type | Condition |
|---|---|
| ArgumentOutOfRangeException | Thrown if |