Sam Farmer head shot

Sam Farmer

Growing up I never imagined I would play bass guitar for the Dave Matthews Band. And indeed it never happened.

But I have become a passionate and pretty good web developer.


10 Little Ones: Memory and CPU Figures (#1)

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:

view plain print about
1<b>CPU Usage</b> #getCPUUsage()#<br><br>
2
3<b>System Memory</b><br>
4Total #getSystemTotalMemory()#<br>
5Free #getSystemFreeMemory()#<br>
6
7% 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).

Comments (Comment Moderation is enabled. Your comment will not appear until approved.)
Your link "charting functionality" is broken.
# Posted By Raymond Camden | 3/1/12 7:58 AM
Thanks for the heads up. Fixed.
# Posted By Sam Farmer | 3/1/12 9:03 AM
BlogCFC was created by Raymond Camden. This blog is running version 5.9.7. Contact Blog Owner