API is defined in the header file sysroot-*-kos/include/coresrv/stat/value_api.h from the KasperskyOS SDK.
This API lets you receive the values of performance counters, such as counters for the uptime, sizes of memory and objects.
Information about API functions is provided in the table below.
Using the API
To receive the values of performance counters, use the following functions:
KnStatGetValueAsInt64() – get the value of the performance counter in 64-bit signed integer format.KnStatGetValueAsUInt64() – get the value of the performance counter in 64-bit unsigned integer format.KnStatGetValues() – get the set of values of performance counters.KnStatGetObjectValues() – get the set of values of performance counters associated with a system resource (process or thread).The KnStatGetValueAsInt64() and KnStatGetValueAsUInt64() functions use the name parameter to receive the name of the performance counter. The KnStatGetValues() and KnStatGetObjectValues() functions use the names parameter to receive an array containing the names of the performance counters. A performance counter name is a string consisting of one or more segments separated by a dot (see the tables containing the names and values of performance counters below).
The optional prefix parameter is used by the KnStatGetValueAsInt64() and KnStatGetValueAsUInt64() functions to receive the prefix for the performance counter name defined via the name parameter, and the KnStatGetValues() function receives the prefix for the performance counter names defined via the names parameter. This prefix is the initial part of the performance counter name consisting of one or more segments separated by a dot, and it ends with a dot. The prefix parameter is convenient to use when you need to receive the values of multiple performance counters with names that have an identical initial or final part. The prefix also may contain an identical or different initial part.
You can use the KnStatGetObjectValues() function to receive the values of only those performance counters that are associated with a process or thread defined via the handle parameter. However, the names of performance counters associated with a process must be specified without the initial part task.<PID>., and the names of performance counters associated with a thread must be specified without the initial part task.<PID>.thread.<TID>.
Information about API functions
value_api.h functions
Function |
Information about the function |
|---|---|
|
Purpose Gets the value of a performance counter in 64-bit signed integer format. Parameters
Returned values If successful, the function returns |
|
Purpose Gets the value of a performance counter in 64-bit unsigned integer format. Parameters
Returned values If successful, the function returns |
|
Purpose Gets the values of performance counters. Parameters
Returned values If successful, the function returns |
|
Purpose Gets the values of performance counters associated with a system resource (process or thread). Parameters
Returned values If successful, the function returns |
Names and values of performance counters
Uptime counters have values in nanoseconds. Uptime is counted from the startup of the KasperskyOS kernel. Most memory size counters have values defined in memory pages. The size of a memory page is 4 KB for all hardware platforms supported by KasperskyOS. The names of performance counters associated with a process contain the process identifier (PID). The names of performance counters associated with a thread contain the process identifier (PID) and thread identifier (TID). The qualified names of core endpoints can be viewed in Methods of KasperskyOS core endpoints.
System performance counters
Counter name |
Counter value |
|---|---|
|
Number of processes (excluding the kernel process) |
|
Number of threads (including kernel threads) |
|
Total uptime of all processors in user mode |
|
Total uptime of all processors in kernel mode |
|
Total uptime of all processors in idle mode |
|
Total locking time of all threads awaiting IPC |
|
Total locking time of all threads resulting from futex use |
|
Total locking time of all threads resulting from calls of the |
|
Total locking time of all threads due to reasons not related to pending IPC, futex use, or calls of the |
|
Size of installed physical memory, in memory pages |
|
Size of free physical memory, in memory pages |
|
Size of physical memory used as shared memory, in memory pages |
|
Size of physical memory with the "execution access" attribute, in memory pages |
|
Size of physical memory reserved for kernel allocator distribution, in memory pages |
|
Size of free physical memory reserved for kernel allocator distribution, in memory pages |
|
Quantity of physical memory regions distributed by the kernel allocator |
|
Size of physical memory distributed by the kernel allocator (in bytes) |
|
Size of free physical memory that is reserved for kernel allocator distribution and is not available on every processor (computing core), but instead is available only separately on each processor, in bytes |
|
Quantity of DMA buffers |
|
Total size of all DMA buffers, in memory pages |
|
Indicator of ROMFS image in kernel memory ( |
|
Quantity of files in ROMFS image |
|
Size of ROMFS image, in memory pages |
|
Quantity of kernel objects |
|
Quantity of handles |
|
Total size of handle tables, including used and unused identifiers (in bytes) |
|
Quantity of security identifiers (SIDs) |
|
Maximum possible quantity of security identifiers (SIDs) |
|
Quantity of |
|
Quantity of |
|
Quantity of |
Performance counters associated with a processor (computing core)
Counter name |
Counter value |
|---|---|
|
CPU uptime in user mode |
|
CPU uptime in kernel mode |
|
CPU uptime in idle mode |
|
Quantity of thread context switches on the processor |
|
Quantity of interrupts handled on the processor |
|
Quantity of timer interrupts handled on the processor |
|
Quantity of thread rescheduling interrupts handled on the processor |
Performance counters associated with interrupts
Counter name |
Counter value |
|---|---|
|
Maximum number of hardware interrupts that can be registered, including MSI interrupts and interrupts that occur when devices query the interrupt controller via hardware interrupt lines |
|
Quantity of interrupts received by the processor (computing core) |
|
Priority of the interrupt |
|
Indicator that at least one thread is attached to the interrupt ( |
|
Quantity of interrupt handlers |
|
Interrupt conditions (according to the |
Performance counters associated with a process
Counter name |
Counter value |
|---|---|
|
State of the process (according to the list of |
|
Number of threads in the process |
|
Time between kernel startup and loading of the program image into process memory |
|
Size of program image in process memory, in bytes |
|
Parent process ID (PPID) |
|
Priority of the initial thread of the process |
|
Size of physical memory used by the process, in memory pages (describes only the memory that is allocated directly for the process; for example, if the memory of a process is mapped to an MDL buffer created by another process, the size of this buffer is not included in this value) |
|
Size of process virtual memory, in memory pages |
|
Size of process virtual memory mapped to shared physical memory, in memory pages |
|
Size of process pages table, in memory pages |
|
Size of DMA memory mapped to process virtual memory, in memory pages |
|
Size of MMIO memory mapped to process virtual memory, in memory pages |
|
Total execution time of all process threads in user mode |
|
Total execution time of all process threads in kernel mode |
|
Total locking time of all process threads awaiting IPC |
|
Total locking time of all process threads resulting from futex use |
|
Total locking time of all process threads resulting from calls of the |
|
Total locking time of all process threads due to reasons not related to pending IPC, futex use, or calls of the |
|
Quantity of handles owned by the process |
|
Size of process handles table, including used and unused identifiers (in bytes) |
|
Quantity of handles that can be accommodated in the process handles table |
|
Quantity of user resource handles created by the process |
|
Quantity of |
|
Quantity of |
|
Quantity of |
Performance counters associated with a thread
Counter name |
Counter value |
|---|---|
|
Execution time of process thread in user mode |
|
Execution time of process thread in kernel mode |
|
Locking time of process thread awaiting IPC |
|
Locking time of process thread resulting from futex use |
|
Locking time of process thread resulting from calls of the |
|
Locking time of process thread due to reasons not related to pending IPC, futex use, or calls of the |
|
Quantity of process thread evictions by other threads |
|
Priority of the thread. |
|
Thread scheduler class (in accordance with the |
|
Quantity of |
|
Quantity of |
|
Quantity of |