Linux commands: Difference between revisions

Jump to navigation Jump to search
105 bytes added ,  27 July 2015
Line 243: Line 243:
=== system CPU and memory usage  ===
=== system CPU and memory usage  ===
CPU usage / system load average
CPU usage / system load average
* Windows:  
* {{Win}}:  
** namespace: ROOT\CIMV2
** namespace: ROOT\CIMV2
** WQL query: {{kbd | key= SELECT LoadPercentage FROM Win32_Processor}}; No need to divid by CPU cores number for Win8
** WQL query: {{kbd | key= SELECT LoadPercentage FROM Win32_Processor}}; No need to divid by CPU cores number for Win8
** output example: 24 ([https://msdn.microsoft.com/zh-tw/library/system.uint16(v=vs.110).aspx UInt16, 16 bit Unsigned Integer]) unit: %
** output example: 24 ([https://msdn.microsoft.com/zh-tw/library/system.uint16(v=vs.110).aspx UInt16, 16 bit Unsigned Integer]) unit: %
** CPU usage = LoadPercentage; unit: %
** CPU usage = LoadPercentage; unit: %
* Linux / freebsd / Mac:  
* freebsd, {{Linux}} & {{Mac}}:  
** PHP function [http://php.net/manual/en/function.sys-getloadavg.php sys_getloadavg()] unit: %; '''Need''' to divid by CPU cores number
** PHP function [http://php.net/manual/en/function.sys-getloadavg.php sys_getloadavg()] unit: %; '''Need''' to divid by CPU cores number


Memory usage
Memory usage
* Windows:
* {{Win}}:
** namespace: ROOT\CIMV2
** namespace: ROOT\CIMV2
** WQL query: {{kbd | key= SELECT FreePhysicalMemory, TotalVisibleMemorySize FROM Win32_OperatingSystem}};
** WQL query: {{kbd | key= SELECT FreePhysicalMemory, TotalVisibleMemorySize FROM Win32_OperatingSystem}};
** output example: 21683460 ([https://msdn.microsoft.com/zh-tw/library/system.uint64(v=vs.110).aspx UInt64, 64 bit Unsigned Integer]) unit: KB
** output example: 21683460 ([https://msdn.microsoft.com/zh-tw/library/system.uint64(v=vs.110).aspx UInt64, 64 bit Unsigned Integer]) unit: KB
** memory usage = (FreePhysicalMemory * 100) / TotalVisibleMemorySize; unit: %
** memory usage = (FreePhysicalMemory * 100) / TotalVisibleMemorySize; unit: %
* Linux / freebsd:
 
* freebsd & {{Linux}}:
** command: {{kbd | key = free}}
** command: {{kbd | key = free}}
** output example:  
** output example:  
Line 267: Line 268:
</pre>
</pre>
** memory usage = 7922496 / 8060416; unit: %
** memory usage = 7922496 / 8060416; unit: %
* Mac (Darwin):
 
* {{Mac}} (known as [https://zh.wikipedia.org/zh-tw/Darwin_(%E6%93%8D%E4%BD%9C%E7%B3%BB%E7%BB%9F) Darwin]):
** command: {{kbd | key = top -l 1 | grep PhysMem:}}
** command: {{kbd | key = top -l 1 | grep PhysMem:}}
** output example: PhysMem: 8017M used (1486M wired), 172M unused.
** output example: PhysMem: 8017M used (1486M wired), 172M unused.

Navigation menu