Components | All | New | MacOS | Windows | Linux | iOS | ||||
Examples | Mac & Win | Server | Client | Guides | Statistic | FMM | Blog | Deprecated | Old |
SystemInfo.AppResourceUsageStatistics
Queries application resource usage statistics for current application.
Component | Version | macOS | Windows | Linux | Server | iOS SDK |
SystemInfo | 15.3 | ✅ Yes | ❌ No | ❌ No | ✅ Yes, on macOS | ❌ No |
Parameters
Parameter | Description | Example | Flags |
---|---|---|---|
Version | The version of info requested. Default is version 6 with all information. You can pass lower number if you need less information. |
6 | Optional |
Result
Returns JSON or error.
Description
Queries application resource usage statistics for current application.The SystemInfo.AppResourceUsageStatistics function is a macOS-specific function that retrieves detailed resource usage statistics for the current process.
It fills a versioned rusage info structure with metrics such as CPU time, memory footprint, disk I/O, and energy usage. This API is part of the libproc library and allows fine-grained performance monitoring, including per-QoS and power-weighted data, not available through standard POSIX interfaces. Our plugin returns this as JSON.
Field | Version | Description |
---|---|---|
uuid | 0 | UUID of the process |
user_time | 0 | User CPU time in nanoseconds |
system_time | 0 | System CPU time in nanoseconds |
pkg_idle_wkups | 0 | Package idle wakeups |
interrupt_wkups | 0 | Interrupt wakeups |
pageins | 0 | Number of page-ins (from disk to memory) |
wired_size | 0 | Wired memory size in bytes |
resident_size | 0 | Resident memory size in bytes |
phys_footprint | 0 | Physical memory footprint in bytes (more accurate than resident size) |
proc_start_abstime | 0 | Absolute time (mach timebase) when the process started |
proc_exit_abstime | 0 | Absolute time when the process exited (0 if still running) |
child_user_time | 1 | Total user CPU time of child processes (nanoseconds) |
child_system_time | 1 | Total system CPU time of child processes (nanoseconds) |
child_pkg_idle_wkups | 1 | Package idle wakeups of children |
child_interrupt_wkups | 1 | Interrupt wakeups of children |
child_pageins | 1 | Page-ins by child processes |
child_elapsed_abstime | 1 | Wall clock time used by child processes (absolute time units) |
diskio_bytesread | 2 | Total bytes read from disk |
diskio_byteswritten | 2 | Total bytes written to disk |
cpu_time_qos_default | 3 | CPU time at default QoS level (nanoseconds) |
cpu_time_qos_maintenance | 3 | CPU time at maintenance QoS level |
cpu_time_qos_background | 3 | CPU time at background QoS level |
cpu_time_qos_utility | 3 | CPU time at utility QoS level |
cpu_time_qos_legacy | 3 | CPU time at legacy QoS level |
cpu_time_qos_user_initiated | 3 | CPU time at user-initiated QoS level |
cpu_time_qos_user_interactive | 3 | CPU time at user-interactive QoS level |
billed_system_time | 3 | Billed system time (may differ from actual system time) |
serviced_system_time | 3 | Actual system service time |
logical_writes | 4 | Logical write calls (may be coalesced or buffered writes) |
lifetime_max_phys_footprint | 4 | Max physical memory footprint reached during the process lifetime |
instructions | 4 | Number of instructions executed (if supported) |
cycles | 4 | Number of CPU cycles consumed (if supported) |
billed_energy | 4 | Energy billed (nanojoules) |
serviced_energy | 4 | Energy actually used (nJ) |
interval_max_phys_footprint | 4 | Peak memory in recent sample interval |
runnable_time | 4 | Time spent runnable, eg, on CPU run queue |
flags | 5 | Internal status flags |
user_ptime | 6 | Power-weighted user time |
system_ptime | 6 | Power-weighted system time |
pinstructions | 6 | Power-weighted instructions |
pcycles | 6 | Power-weighted cycles |
energy_nj | 6 | Total energy used (nanojoules) |
penergy_nj | 6 | Power-weighted energy |
secure_time_in_system | 6 | Secure system time (likely TEE/SEP-related) |
secure_ptime_in_system | 6 | Power-weighted secure system time |
neural_footprint | 6 | Neural engine memory used |
lifetime_max_neural_footprint | 6 | Max neural footprint lifetime |
interval_max_neural_footprint | 6 | Max neural footprint in interval |
Examples
Query the resource usage:
Set Variable [ $json: Value: MBS( "SystemInfo.AppResourceUsageStatistics" ) ]
Example result:
{
"proc_start_abstime" : 19488832800055,
"flags" : 0,
"energy_nj" : 12930421197,
"cycles" : 19548064738,
"neural_footprint" : 0,
"pageins" : 801,
"system_ptime" : 18468967,
"billed_system_time" : 37294579,
"diskio_byteswritten" : 479232,
"proc_exit_abstime" : 0,
"child_user_time" : 0,
"cpu_time_qos_user_interactive" : 13764390,
"system_time" : 36430490,
"cpu_time_qos_utility" : 109626,
"child_system_time" : 0,
"cpu_time_qos_legacy" : 19151865,
"version" : 6,
"uuid" : "C68ECD17-38FB-31DC-AA31-83B7CD11C613",
"wired_size" : 0,
"pkg_idle_wkups" : 142,
"cpu_time_qos_background" : 401773,
"runnable_time" : 183496960,
"penergy_nj" : 12401806171,
"child_pageins" : 0,
"interval_max_neural_footprint" : 0,
"serviced_system_time" : 6166545,
"diskio_bytesread" : 128475136,
"phys_footprint" : 588584512,
"user_ptime" : 70919191,
"child_interrupt_wkups" : 0,
"child_elapsed_abstime" : 0,
"cpu_time_qos_user_initiated" : 6066361,
"cpu_time_qos_maintenance" : 0,
"billed_energy" : 1512777578,
"instructions" : 46808473151,
"cpu_time_qos_default" : 127422445,
"lifetime_max_phys_footprint" : 596039232,
"interval_max_phys_footprint" : 596039232,
"lifetime_max_neural_footprint" : 0,
"user_time" : 130485970,
"child_pkg_idle_wkups" : 0,
"serviced_energy" : 66274559,
"interrupt_wkups" : 3443,
"resident_size" : 521551872,
"pinstructions" : 39884283671,
"pcycles" : 13315772972,
"secure_time_in_system" : 0,
"secure_ptime_in_system" : 0,
"logical_writes" : 2412548
}
Check disk I/O for setting a field:
# We capture statistics before
Set Variable [ $j1 ; Value: MBS( "SystemInfo.AppResourceUsageStatistics") ]
Pause/Resume Script [ Duration (seconds): ,5 ]
#
Set Field [ Test::test ; Random ]
# Ask FileMaker to save changes
Commit Records/Requests [ With dialog: Off ]
# flush caches to make sure FileMaker does write
Flush Cache to Disk
#
# We capture statistics after
Pause/Resume Script [ Duration (seconds): ,5 ]
Set Variable [ $j2 ; Value: MBS( "SystemInfo.AppResourceUsageStatistics") ]
#
# calculate difference and show
Set Variable [ $w1 ; Value: JSONGetElement ( $j1 ; "logical_writes" ) ]
Set Variable [ $w2 ; Value: JSONGetElement ( $j2 ; "logical_writes" ) ]
Set Variable [ $d1 ; Value: JSONGetElement ( $j1 ; "diskio_byteswritten" ) ]
Set Variable [ $d2 ; Value: JSONGetElement ( $j2 ; "diskio_byteswritten" ) ]
Show Custom Dialog [ "bytes written" ; ($w2 - $w1) & " bytes logical" & ¶ & ($d2 - $d1) & " bytes written" ]
See also
Release notes
- Version 15.3
- Added SystemInfo.AppResourceUsageStatistics function.
Blog Entries
This function is free to use.
Created 17th June 2025, last changed 20th June 2025
