abla/process/metrics

Generated from source.

Import with import "abla/process/metrics".

Source: abla/process/metrics/entry.ab

processMetricsWindows (fun)

trusted fun processMetricsWindows(): array<int>

The Windows runtime's processInfo (system call 4008) as [resident, virtual, descriptors, start time in ms], or [] off Windows or when it fails.

ProcessMetrics (class)

class ProcessMetrics(
    // CPU time spent in user code and in the kernel on its behalf.
    val cpuUserMicroseconds: int,
    val cpuSystemMicroseconds: int,
    // Resident set size and virtual size.
    val residentBytes: int,
    val virtualBytes: int,
    // Open file descriptors (sockets included) and the soft limit on them.
    val openDescriptors: int,
    val maximumDescriptors: int,
    // When the process started, in milliseconds since 1970-01-01T00:00:00Z.
    val startTimeMilliseconds: int,
    // Bytes the Abla allocator has handed out and not yet freed, garbage the
    // collector has not reclaimed included.
    val heapBytes: int,
    // The data segment's size (Linux VmData: heap and private anonymous
    // mappings, what Prometheus reports as process_heap_bytes); -1 elsewhere.
    val dataBytes: int
)

Stores CPU usage, memory, descriptor counts and start time for a process.

ProcessMetrics.cpuUserSeconds (method)

fun cpuUserSeconds(): f64

Converts the stored user CPU time from microseconds to seconds.

ProcessMetrics.cpuSystemSeconds (method)

fun cpuSystemSeconds(): f64

Converts the stored kernel CPU time from microseconds to seconds.

ProcessMetrics.cpuSeconds (method)

fun cpuSeconds(): f64

Returns the sum of user and system CPU time in seconds.

ProcessMetrics.startTimeSeconds (method)

fun startTimeSeconds(): f64

Converts the stored Unix start time from milliseconds to seconds.

processMetrics (fun)

fun processMetrics(): ProcessMetrics

Every metric in one read.

processMetricsU32 (fun)

trusted fun processMetricsU32(buffer: NativeByteBuffer, offset: int): int

Reads an unsigned 32-bit little-endian metric from the given buffer offset.

processCpuMicroseconds (fun)

trusted fun processCpuMicroseconds(): array<int>

[user, system] CPU time in microseconds (getrusage RUSAGE_SELF), or [-1, -1].

processCpuUserMicroseconds (fun)

fun processCpuUserMicroseconds(): int

Returns this process's user CPU time in microseconds, or -1 if unavailable.

processCpuSystemMicroseconds (fun)

fun processCpuSystemMicroseconds(): int

Returns this process's kernel CPU time in microseconds, or -1 if unavailable.

processMetricsLineNumber (fun)

fun processMetricsLineNumber(text: string, name: string): int

The number after name on its line of a /proc file: "VmRSS: 1234 kB" in /proc/self/status, "btime 1700000000" in /proc/stat; -1 without one.

processMetricsKilobytes (fun)

fun processMetricsKilobytes(value: int): int

Converts kilobytes to bytes and returns -1 for a negative input.

processMemoryBytes (fun)

trusted fun processMemoryBytes(): array<int>

[resident, virtual, data] size in bytes, or -1 for one that cannot be read (data, Linux's VmData, always on macOS).

processResidentBytes (fun)

fun processResidentBytes(): int

Returns this process's resident memory in bytes, or -1 if unavailable.

processVirtualBytes (fun)

fun processVirtualBytes(): int

Returns this process's virtual memory in bytes, or -1 if unavailable.

processDataBytes (fun)

fun processDataBytes(): int

The data segment's size (Linux VmData) in bytes; -1 off Linux.

processOpenDescriptors (fun)

trusted fun processOpenDescriptors(): int

The number of open file descriptors, or -1.

processMaximumDescriptors (fun)

trusted fun processMaximumDescriptors(): int

The soft limit on open file descriptors (RLIMIT_NOFILE), or -1.

processMetricsStatField (fun)

fun processMetricsStatField(stat: string, index: int): int

Field index (1-based, as in proc(5)) of /proc/self/stat; the second field, the command name, is parenthesized and may hold spaces, so counting starts after its closing parenthesis.

processMetricsClockTicks (fun)

fun processMetricsClockTicks(): int

The kernel's clock tick rate (AT_CLKTCK in the auxiliary vector), the unit of /proc/self/stat's times.

processStartTimeMilliseconds (fun)

trusted fun processStartTimeMilliseconds(): int

When the process started, in milliseconds since the Unix epoch, or -1.

processHeapBytes (fun)

fun processHeapBytes(): int

Bytes the Abla allocator holds for live and not yet collected values: the runtime's own running count, a single read.

Built from Abla v0.2.79 source ba5d6b7d. Examples and generated signatures follow that source revision.