客户端性能测试通过performanceCounter监控客户端性能指标

<p> PerformanceCounter PTCounter = new PerformanceCounter("Process",<br> "% Processor Time",<br> "AliIM");<br> logfile("% Processor Time:" + PTCounter.NextValue().ToString());<br> //内存<br> PerformanceCounter WSCounter = new PerformanceCounter("Process",<br> "Working Set",<br> "AliIM");<br> logfile("Working Set:" + ((double)WSCounter.NextValue() / 1024).ToString());</p>
<p> //内存最高值<br> PerformanceCounter MemeryCounter = new PerformanceCounter("Process",<br> "Working Set Peak",<br> "AliIM");<br> logfile("Working Set Peak:" + ((double)MemeryCounter.NextValue() / 1024).ToString());</p>
<p><br> //虚拟内存<br> PerformanceCounter PBCounter = new PerformanceCounter("Process",<br> "Private Bytes",<br> "AliIM");<br> logfile("Private Bytes:" + ((double)PBCounter.NextValue() / 1024).ToString());</p>
<p> //句柄数<br> PerformanceCounter HCCounter = new PerformanceCounter("Process",<br> "Handle Count",<br> "AliIM");<br> logfile("Handle Count:" + HCCounter.NextValue() .ToString());</p>
<p> //线程数Thread Count<br> PerformanceCounter TCCounter = new PerformanceCounter("Process",<br> "Thread Count",<br> "AliIM");<br> logfile("Thread Count:" + TCCounter.NextValue() .ToString());</p>
<p></p>
<p>//补充得到GDI OBJECTS</p>
<p> Process process;<br> process = System.Diagnostics.Process.GetProcessesByName("AliIM")[0];<br><br> logfile("GDI Objects Count:" + GetGuiResources(process.Handle, 0));</p>
<p></p>
<p> [DllImport("User32")]</p>
<p> extern public static int GetGuiResources(IntPtr hProcess, int uiFlags);</p>
<p></p>
<p></p>
<p></p>
<p></p>
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值