Topics   All   MacOS (Only)   Windows (Only)   Linux (Only, Not)   iOS (Only, Not)  
Components   Crossplatform Mac & Win   Server   Client   Old   Deprecated   Guides   Examples   Videos
New in version: 10.0   10.1   10.2   10.3   10.4   10.5   11.0   11.1   11.2   11.3    Statistic    FMM    Blog  

SystemInfo.CPULoad

Queries system load statistics.

Component Version macOS Windows Linux Server iOS SDK
SystemInfo 10.5 ✅ Yes ❌ No ❌ No ✅ Yes, on macOS ✅ Yes
MBS( "SystemInfo.CPULoad" )

Parameters

none

Result

Returns JSON or error.

Description

Queries system load statistics.
Returns a JSON with entries for system, user and idle. Those counters count up, so you may need to query several times and check deltas.

Examples

Query system load on macOS:

MBS( "SystemInfo.CPULoad" )

Example result:
{
  "system" : 54822806,
  "nice" : 0,
  "idle" : 1143567712,
  "user" : 78572673
}

Query CPU Load:

Let(
[
// query load
r1 = MBS( "SystemInfo.CPULoad" );

// separate values
system1 = JSONGetElement ( r1; "system" );
idle1 = JSONGetElement ( r1; "idle" );
user1 = JSONGetElement ( r1; "user" );
total1 = user1+idle1+user1;

// make a 0.5 second pause
t = MBS("Time.Sleep"; 500);

// now query again
r2 = MBS( "SystemInfo.CPULoad" );

// separate values
system2 = JSONGetElement ( r2; "system" );
idle2 = JSONGetElement ( r2; "idle" );
user2 = JSONGetElement ( r2; "user" );
total2 = user2+idle2+user2;

// calculate deltas
deltaTotal = total2 - total1;
deltaSystem = system2 - system1;
deltaIdle = idle2 - idle1;
deltaUser = user2 - user1;

// and calculate the percentage used
load = (deltaSystem+deltaUser) / deltaTotal
]; load)

See also

Release notes

Blog Entries

FileMaker Magazin

Created 12nd October 2020, last changed 12nd October 2020


SystemInfo.CPUBrandString - SystemInfo.ComputerName

Feedback: Report problem or ask question.




Links
MBS FileMaker tutorial videos

Start Chat