10 Little Ones: Memory and CPU Figures (#1)
February 29, 2012
ColdFusion 10 beta adds three new functions that provide system stats:
- getCPUUsage()
- getSystemFreeMemory()
- getSystemTotalMemory()
The first returns a percentage while the other two return the amount of bytes. Here is a quick example:
CPU Usage #getCPUUsage()#
System Memory
Total #getSystemTotalMemory()#
Free #getSystemFreeMemory()#
% Free: #numberFormat( ( getSystemFreeMemory()/getSystemTotalMemory() ) *100, "999.99")#
Which produces
CPU Usage 24.875624
System Memory
Total 8589934592
Free 1640640512
% Free: 19.10
Pretty straightforward and information that would look good in the new
charting functionality...
(This is the first in a series to show off some of the smaller additions to ColdFusion 10).
2 Comments
Some comments have been lost over the years due to moving hosts.
By: Raymond Camden 03/01/2012 7:58 AM