CX Framework
Cross-platform C utility framework
Loading...
Searching...
No Matches
sysinfo_private.h
1#pragma once
2
3#include <cx/platform/base.h>
4#include <cx/sys/sysinfo.h>
5
6// Contract every platform backend implements.
7//
8// Backends fill in only what the operating system natively reports, and set the matching valid
9// flags. Everything else -- zeroing the structure, stamping the sample time, the processor
10// count, and the derived totals -- is done once in sysinfo.c, so no backend repeats it.
11
12// Fill in what the machine's memory looks like. Returns false only if nothing at all could be
13// read.
14bool _sysPlatformMemInfo(SysMemInfo* out);
15
16// Fill in the per-state processor times, in microseconds summed over every processor. busy and
17// total are computed by the caller from whatever is filled in here.
18bool _sysPlatformCPUTimes(SysCPUTimes* out);
19
20// Fill in either or both of uptime and boottime; the caller derives the other one.
21bool _sysPlatformUptime(SysUptime* out);
22
23// Fill in the run queue averages. Platforms that keep no such figure set CX_NotSupported.
24bool _sysPlatformLoadAvg(SysLoadAvg* out);
25
26// Per-process readings. proc is the handle the caller supplied, or NULL when the caller only
27// had a process id -- backends that need a native handle use proc's when there is one and open
28// a temporary one otherwise. pid is always valid, and always matches proc when proc is set.
29bool _sysPlatformProcMemInfo(ProcMemInfo* out, ProcessID pid, Process* proc);
30bool _sysPlatformProcCPUTimes(ProcCPUTimes* out, ProcessID pid, Process* proc);
31bool _sysPlatformProcIOInfo(ProcIOInfo* out, ProcessID pid, Process* proc);
Compiler and platform detection macros.
int64 ProcessID
Operating system process id.
Definition process.h:128
Processor time one process has used since it started.
Definition sysinfo.h:261
How much memory one process is using.
Definition sysinfo.h:227
How much memory the machine has and how much of it is spoken for.
Definition sysinfo.h:126
How long the machine has been running.
Definition sysinfo.h:191
Processor, memory and I/O statistics for the machine and for individual processes.