SystemInfo.CPULoad
------------------

Queries system load statistics.

| Component | Version | macOS | Windows | Linux | Server | iOS SDK |
|---|---|---|---|---|---|---|
| [SystemInfo](component_SystemInfo.md) | [10.5](newinversion105.md) | ✅ Yes | ✅ Yes | ❌ No | ✅ Yes, on macOS and Windows | ✅ 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.  
  
The nice value is always zero for Windows.  
### Examples

Query system load on macOS:

 MBS ( "SystemInfo.CPULoad" )  
<small>  
Example result:   
{ "system" : 54822806 , "nice" : 0 , "idle" : 1143567712 , "user" : 78572673 } </small>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](TimeSleep.md)"; 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

- [Time.Sleep](TimeSleep.md)

### Release notes

- **Version 14.2**
    - Added Windows support for [SystemInfo.CPULoad](https://www.mbsplugins.eu/SystemInfoCPULoad.shtml) function.
- **Version 10.5**
    - Added [SystemInfo.CPULoad](https://www.mbsplugins.eu/SystemInfoCPULoad.shtml) function.

### Blog Entries

- [MBS FileMaker Plugin, version 14.2pr1](https://www.mbsplugins.de/archive/2024-04-02/MBS_FileMaker_Plugin_version_1/monkeybreadsoftware_blog_filemaker)
- [New in MBS FileMaker Plugin 10.5](https://www.mbsplugins.de/archive/2020-11-23/New_in_MBS_FileMaker_Plugin_10/monkeybreadsoftware_blog_filemaker)
- [Neues MBS FileMaker Plugin 10.5 - Über 6400 Funktionen in einem Plugin](https://www.mbsplugins.de/archive/2020-11-17/Neues_MBS_FileMaker_Plugin_105/monkeybreadsoftware_blog_filemaker)
- [MBS FileMaker Plugin 10.5 - More than 6400 Functions In One Plugin](https://www.mbsplugins.de/archive/2020-11-17/MBS_FileMaker_Plugin_105_-_Mor/monkeybreadsoftware_blog_filemaker)
- [MBS FileMaker Plugin, version 10.5pr4](https://www.mbsplugins.de/archive/2020-10-13/MBS_FileMaker_Plugin_version_1/monkeybreadsoftware_blog_filemaker)

### FileMaker Magazin

- [Ausgabe 6/2020, Seite 26](https://filemaker-magazin.de/neuigkeit/4118-Appetithappen-FMM_202006)

This function is free to use.

Created 12nd October 2020 , last changed 25th March 2024

  
[SystemInfo.CPUBrandString](SystemInfoCPUBrandString.md) - [SystemInfo.ComputerName](SystemInfoComputerName.md)

[HTML Version](SystemInfoCPULoad.shtml)