博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
客户端性能测试通过performanceCounter监控客户端性能指标
阅读量:6321 次
发布时间:2019-06-22

本文共 1376 字,大约阅读时间需要 4 分钟。

PerformanceCounter PTCounter = new PerformanceCounter("Process",
                                        "% Processor Time",
                                         "AliIM");
            logfile("% Processor Time:" + PTCounter.NextValue().ToString());
            //内存
            PerformanceCounter WSCounter = new PerformanceCounter("Process",
                                                                    "Working Set",
                                                                     "AliIM");
            logfile("Working Set:" + ((double)WSCounter.NextValue() / 1024).ToString());
            //内存最高值
            PerformanceCounter MemeryCounter = new PerformanceCounter("Process",
                                                                    "Working Set Peak",
                                                                     "AliIM");
            logfile("Working Set Peak:" + ((double)MemeryCounter.NextValue() / 1024).ToString());
            //虚拟内存
            PerformanceCounter PBCounter = new PerformanceCounter("Process",
                                                              "Private Bytes",
                                                               "AliIM");
            logfile("Private Bytes:" + ((double)PBCounter.NextValue() / 1024).ToString());
            //句柄数
            PerformanceCounter HCCounter = new PerformanceCounter("Process",
                                                  "Handle Count",
                                                   "AliIM");
            logfile("Handle Count:" + HCCounter.NextValue() .ToString());
            //线程数Thread Count
            PerformanceCounter TCCounter = new PerformanceCounter("Process",
                                      "Thread Count",
                                       "AliIM");
            logfile("Thread Count:" + TCCounter.NextValue() .ToString());
//补充得到GDI OBJECTS
            Process process;
            process = System.Diagnostics.Process.GetProcessesByName("AliIM")[0];
            
            logfile("GDI Objects Count:" + GetGuiResources(process.Handle, 0));
        [DllImport("User32")]
        extern public static int GetGuiResources(IntPtr hProcess, int uiFlags);
本文转自elbertchen 51CTO博客,原文链接:http://blog.51cto.com/linkyou/283253,如需转载请自行联系原作者
你可能感兴趣的文章
VC 输入法注入源码
查看>>
BinaryTree I
查看>>
IE6-IE9兼容性问题列表及解决办法_补充之四:HTC (Html Components) 功能逐渐被IE抛弃...
查看>>
Verilog与C/C++的一些区别
查看>>
DIV焦点事件详解 --【focus和tabIndex】
查看>>
vim php代码规范
查看>>
最最基本的Git入门 -- 本地仓库操作
查看>>
机器学习平台跃迁,AI中台才是大势所趋
查看>>
Imperva开源域目录控制器,简化活动目录集成
查看>>
微软发布预览版SQL Server跨平台开发工具
查看>>
Uber推出数据湖集成神器DBEvents,支持MySQL、Cassandra等
查看>>
Entity Framework Core 2.0的新特性
查看>>
[deviceone开发]-do_Http组件示例
查看>>
linux yum命令
查看>>
职场中怎样评估系统架构师的成绩?
查看>>
(总结)Nginx/LVS/HAProxy负载均衡软件的优缺点详解
查看>>
centos7 搭建nfs共享文件
查看>>
linux命令
查看>>
我的友情链接
查看>>
Python中fnmatch模块的使用
查看>>