Windows Phone 监视内存使用情况 推荐
2011-05-02 11:09
302 查看
在调试Windows Phone程序的时候,我们通常需要知道当前程序占用的内存是多少,有没有发生内存泄露。
在之前的Windows Phone 7 Tips (5) 中有提到EnableFrameRateCounter 是监视程序运行时的帧速率,具体的用法如下
// Show graphics profiling information while debugging.
if (System.Diagnostics.Debugger.IsAttached)
{
// Display the current frame rate counters.
Application.Current.Host.Settings.EnableFrameRateCounter = true;
}
以下是右侧工具条的具体解释
这里并没有我们想要看的内存的使用情况,如何去做呢。在Windows Phone 中有这么一个类 Microsoft.Phone.Info.DeviceExtendedProperties 提供内存的使用情况,具体的属性指如下:
可能你需要写如下的代码来查看这些数据
当然还有更简单的方法,就是引入一个dll(Dll下载),然后写几段代码就完事了。
默认是2秒刷新一次,当然你可以自己设定刷新间隔
参考
http://blogs.msdn.com/b/mikeormond/archive/2010/12/16/monitoring-memory-usage-on-windows-phone-7.aspx
http://dotnetprofessional.com/blog/post/2010/09/27/Debug-Memory-Counter-for-Windows-Phone-7.aspx
附件:http://down.51cto.com/data/2358250
在之前的Windows Phone 7 Tips (5) 中有提到EnableFrameRateCounter 是监视程序运行时的帧速率,具体的用法如下
// Show graphics profiling information while debugging.
if (System.Diagnostics.Debugger.IsAttached)
{
// Display the current frame rate counters.
Application.Current.Host.Settings.EnableFrameRateCounter = true;
}
以下是右侧工具条的具体解释
这里并没有我们想要看的内存的使用情况,如何去做呢。在Windows Phone 中有这么一个类 Microsoft.Phone.Info.DeviceExtendedProperties 提供内存的使用情况,具体的属性指如下:
属性值 | 返回值 | 描述 |
DeviceTotalMemory | long integer | 设备总内存(单位字节) |
ApplicationCurrentMemoryUsage | long integer | 当前应用程序内存使用量(单位字节) |
ApplicationPeakMemoryUsage | long integer | 当前应用程序最高使用量(单位字节) |
当然还有更简单的方法,就是引入一个dll(Dll下载),然后写几段代码就完事了。
dnp.Counter.EnableMemoryCounter = true;
默认是2秒刷新一次,当然你可以自己设定刷新间隔
dnp.Counter.SetTimerInterval(1);
参考
http://blogs.msdn.com/b/mikeormond/archive/2010/12/16/monitoring-memory-usage-on-windows-phone-7.aspx
http://dotnetprofessional.com/blog/post/2010/09/27/Debug-Memory-Counter-for-Windows-Phone-7.aspx
附件:http://down.51cto.com/data/2358250
相关文章推荐
- Windows Phone 监视内存使用情况
- Windows Phone 监视内存使用情况
- AIX 7监视内存的使用情况(ps、sar、svmon 和 vmstat)并分析其结果
- free、vmstat监视内存使用情况
- 如何使用 DBCC MEMORYSTATUS 命令来监视 SQL Server 2005 中的内存使用情况
- 优化 AIX 7 内存性能: 监视内存的使用情况(ps、sar、svmon 和 vmstat)并分析其结果
- 监视内存的使用情况
- 检查指定进程内存使用情况的nagios脚本 推荐
- 查看Linux服务器的内存使用情况
- nagios监控主机内存使用情况
- 使用showmap分析android进程内存占用情况
- Windows下用C语言获取进程cpu使用率,内存使用,IO情况
- 尚客:查看Linux服务器内存使用情况
- 虚拟机内存使用情况详解
- Python以邮件的方式发送由各个区服Redis数据库内存使用情况组成的Zabbix Screen图片
- 写出方法获取ios内存使用情况
- linux free内存使用情况
- 监视磁盘空间和使用情况
- 监视磁盘使用情况的Shell脚本(本地+远程)
- 用 .NET Memory Profiler 跟踪.net 应用内存使用情况--基本应用篇 (转载)