简体   繁体   中英

Fine-grained memory profiling in C#

I'm building a small simulation/profiling tool for an application that I'll be working on over the next year. The profiling tool is to be used in my build server such that it can generate some metrics of my application's performance as the development progresses.

I have previous experience with memory profilers, but to my knowledge the existing products does not suit my needs, where:

  • I can profile the memory allocation of individual methods and data structures
  • I can invoke the profiler as part of my build process, that is:
    • Either by command-line or directly programmable with in .NET.

How can I achieve this? Ideally I would have something like the Process class although more fine-grained.

After toying around with Redgate's Profiler API and looking at the CLR Profiler source code, I came to the conclusion that perhaps the easiest solution would be to simply do some UI automation.

Using AutoHotKey I can start CLRProfiler on my app, find the correct allocations and dump the stats I need in text files.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM