使用VMI获取服务器端物理内存、CPU
来源:互联网 发布:淘宝助理是做什么工作 编辑:程序博客网 时间:2024/05/16 08:55
ConnectionOptions options =
new
ConnectionOptions();
options.Username =
"administrator"
;
options.Password =
"********"
;
// Make a connection to a remote computer.
// Replace the "FullComputerName" section of the
// string "\\\\FullComputerName\\root\\cimv2" with
// the full computer name or IP address of the
// remote computer.
ManagementScope scope =
new
ManagementScope(
"\\\\FullComputerName\\root\\cimv2"
, options);
scope.Connect();
//Query system for Operating System information
ObjectQuery query =
new
ObjectQuery(
"select * from Win32_Processor"
);
ManagementObjectSearcher searcher =
new
ManagementObjectSearcher(scope, query);
ManagementObjectCollection queryCollection = searcher.Get();
foreach
(ManagementObject m
in
queryCollection)
{
Console.WriteLine(
"CPU : {0}"
,
m[
"LoadPercentage"
].ToString());
//cpu 使用率
}
double
totalMem = 0;
string
strMsg =
""
;
ObjectQuery query1 =
new
ObjectQuery(
"Select TotalPhysicalMemory from Win32_LogicalMemoryConfiguration"
);
ManagementObjectSearcher search =
new
ManagementObjectSearcher(scope, query1);
int
i = 0;
ManagementObjectCollection queryCollection1 = search.Get();
foreach
(ManagementObject info
in
queryCollection1)
{
i = i + 1;
totalMem += Convert.ToDouble(info[
"TotalPhysicalMemory"
].ToString()) / 1024;
strMsg +=
string
.Format(
"物理内存({0}):大小:{1}MB"
, i, Convert.ToDouble(info[
"TotalPhysicalMemory"
].ToString()) / 1024);
}
strMsg +=
string
.Format(
"总物理内存的大小:{0}MB <br/>"
, totalMem);
Console.WriteLine(strMsg);
0 0
- 使用VMI获取服务器端物理内存、CPU
- java 获取进程ID 物理内存 cpu使用百分比(linux环境)
- windows下获取CPU和物理内存使用率
- 获取当前系统的信息(CPU、物理内存、虚拟内存等
- 使用PDH性能计数器(Windows)获取CPU使用率、可用物理内存、上传/下载速率、磁盘读写速率
- Android 获取手机内存,cpu使用信息
- 获取CPU、内存的使用情况
- 获取系统CPU及内存使用情况
- windows 物理内存获取
- win10 VMI Provider Host占用CPU过高
- 收集物理cpu 内存使用率 网络带宽流量
- 物理内存映射 获取PTE
- Linux下判断cpu物理个数、几核,ubuntu版本号,硬盘、内存等使用情况
- Unity3D服务器端使用PhysX计算物理
- linux c程序获取cpu使用率及内存使用情况
- linux c程序获取cpu使用率及内存使用情况
- 获取操作系统CPU及内存使用信息的另一种方法
- 获取当前进程的CPU使用率和内存使用
- Java中的运行期类型鉴定
- AE加载地图时报错:The operation was attempted on an empty geometry.
- uva live 3882 And Then There Was One 约瑟夫环
- 麻省--算法导论
- Android_开源框架_Volley(Google IO 2013)源代码及内部实现分析
- 使用VMI获取服务器端物理内存、CPU
- crc算法的核心思想
- java设计模式(一)---工厂模式
- 第十二周 阅读项目 多重继承中数据关系
- 多重继承头文件包含时导致class类型重定义的解决办法
- [leetcode] Minimum Size Subarray Sum
- Hadoop之——分布式集群安装过程
- Service总结(一)
- 剑指offer 19 - 二叉树的镜像