TriLib
Search Results for

    Show / Hide Table of Contents

    Class ProcessUtils

    Provides utility methods for gathering process-related information and formatting memory sizes.

    Inheritance
    object
    ProcessUtils
    Inherited Members
    object.GetType()
    object.MemberwiseClone()
    object.ToString()
    object.Equals(object)
    object.Equals(object, object)
    object.ReferenceEquals(object, object)
    object.GetHashCode()
    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 1.

    Returns
    Type Description
    string

    A string representation of value that includes the appropriate size suffix.

    Exceptions
    Type Condition
    ArgumentOutOfRangeException

    Thrown if decimalPlaces is less than zero.

    In this article
    Back to top Generated by DocFX