I need some support reading CPU speed and usage cross platform, I can see that for OSX and Linux using MBS plugins I can get the CPU speed but unable to read its usage,
Does anyone have any pointers they can give me for finding this information out about the clients machine?
System_profiler (Mac only) will show you an entire truck load of information, amongst which you find here :
[code]Hardware:
Hardware Overview:
Model Name: iMac
Model Identifier: iMac12,1
Processor Name: Intel Core i5
Processor Speed: 2.5 GHz
Number of Processors: 1
Total Number of Cores: 4
L2 Cache (per Core): 256 KB
L3 Cache: 6 MB
Memory: 4 GB
Boot ROM Version: IM121.0047.B1F
SMC Version (system): 1.71f21
Serial Number (system): C17FJDZRDHJF
Hardware UUID: 8437B548-0E2A-51E0-88C3-5F3D6CDC841F[/code]
I’m also trying to read the CPU useage on the three platforms. I think this thread is uncomplete, thus I think it would be a good idea to complete it.
Currently, the Windows version works, with the example included.
For Linux, the cat /proc/cpuinfo command returns useful data about the CPU (brand, speed, etc.) but nothing about the current percentage of CPU used.
On the Mac, the DarwinVMStatisticsMBS class seems to return useful information, but the documentation just states to calculate deltas like in the example; yet, I fail to find the example file (the one about DarwinVMStatistics lacks the CPU ticks field).
It would be nice to have a definitive answer to read CPU useage.
I’m also trying to read the CPU useage on the three platforms. For the sake of completeness, here’s what I’ve found:
On the Mac, the DarwinVMStatisticsMBS class is one way to go, assuming you have purchased the plugin. An example can be found in /MacOSX/CPU load info.xojo_binary_project.
The Windows version, already mentioned in this thread, works fine, with the example included with Xojo.
For Linux, the cat /proc/cpuinfo command returns useful data about the CPU (brand, speed, etc.) but nothing ovious about the current percentage of CPU used. However, this command does that:
“grep 'cpu ’ /proc/stat | awk ‘{usage=($2+$4)*100/($2+$4+$5)} END {print usage}’”