CLR内存分析-获取内存详细信息的有效方法 [英] CLR Memory Profiling - Efficient Way to Get Memory Details

查看:67
本文介绍了CLR内存分析-获取内存详细信息的有效方法的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述


我检测了.Net代码并重写了IL,对每个交易进入IIS网站都采用了调用图.

现在,我需要获取内存指标.我正在寻找一种有效的机制来收集以下信息:

对象信息-对象类型,大小
类信息   -类名,实例,大小
垃圾收集信息-GC 0,1,2,大型堆的收集和大小.
线程信息-活动线程及其堆栈跟踪的数量.

因此,我试图定期获取上述所有信息(内存和线程),并将其存储并处理以显示给用户.

我使用具有不同事件掩码的相同分析API(用于IL重写)来收集各自的指标.

我收到对象分配和类加载以及GC事件的回调.在运行时,我将上述信息(例如:objectIDs,classIDs)存储在内存中(猜测这是错误的方法)

但是,在配置文件应用程序中,我得到了一些无法接受的开销.

我还尝试了与市场上其他一些现有的CLR内存分析器一起使用.他们的开销很大.他们可以选择拍摄快照.

我如何在CLR事件探查器中实现这种快照(使用分析API).还是有其他有效的方法(没有快照)来实现这一目标?


I instrument the .Net code and rewrite the IL , take the call graph for each and every transactions comes to the IIS web sites. 

Now i need to take the memory metrics. I am searching for a efficient mechanism to collect the following info:

Object information - Object type , Size 
Class info   - Class name , instances, size
Garbage collection informations -  GC 0,1,2 , Large heap collections and sizes. 
Thread informations - Number of live threads and their stack traces.

So, all the above informations (memory and threads) i am trying to take regularly , store it and process them to show to the user. 

I use the same profiling API(that i used for IL rewriting) with different event masks to collect respective metrics. 

I receive callbacks for object allocations and class loaded and GC events. At runtime i store the above information(example:objectIDs , classIDs,) in memory (guess it is a wrong approach) 

But i get some unacceptable amount of overhead in the profiled application. 

I also tried with some other existing CLR memory profilers in market. They dint have much overhead. They have option for taking snapshot .

How can i achieve this snapshot sort of thing in CLR profiler (using profiling API). Or is there any other efficient way(without snapshot) to achieve this?

推荐答案

Selva VS,

Hi Selva VS,

谢谢您在这里发布.

对于CLR Profiler的快照,可以从以下链接下载源文件.

For snapshots of CLR Profiler, you could download the source file from the following link.

https://www.jetbrains.com/dotmemory/?gclid=CjwKEAjwl9DIBRCG_e3DwsKsizsSJADMmJ11hksPLXqUbMfUDbpioUvbOXb4xvCPMyzQvSVmj7t7lxoCe4rw_wcB& ; gclsrc = aw.ds.ds& dclid = CNjigLmv59MCFRIQvQod1LYFZg

通过时间轴视图可以实时监控应用程序消耗的内存.根据需要收集有关分配的信息.和g et 只需单击一下快照,无需停止性能分析会话,即可添加它们以比较或浏览特定时间范围内的内存流量.

It use timeline view to monitor memory consumed by your application in real time. Collect info on allocations as you need it. And get snapshots with a single click without stopping your profiling session, add them to compare or browse memory traffic during a particular timeframe.

我希望这会有所帮助.

最好的问候,

Wendy


这篇关于CLR内存分析-获取内存详细信息的有效方法的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆