Friday, January 23, 2009

Getting Started with .NET Profiling API

In a couple of words, .NET Profiling API allows writing a program, which can monitor other CLR program's execution. Tools like JetBrains dotTrace and the similar can be written using this API.

There is a lot of detailed information about .NET Profiling API in the Internet, so I will just try to list existing sources.
  1. .NET Internals: The Profiling API. Introduction to monitoring of .NET applications using performance counters and .NET 1.0 Profiling API. Contains theory and source code samples. Unfortunately, samples are written in Delphi and there is no project, which is ready-to-compile-and-work.
  2. Under the Hood: .NET Profiling API and the DNProfiler Tool. Little amount of theory with a couple of practical hints of profiler implementation with 1.0 version of API. Unfortunately, link to DNProfiler is broken.
  3. Inspect and Optimize Memory Usage with the .NET Profiler API. Acticle regarding memory monitoring with sample application and source codes, written with 1.0 version of API. Sample builds well, but doesn't work in my environment, maybe because I tried to build samples with .NET 2.0 and profiler was implemeted version 1.0 of profiling API.
  4. Creating a Custom .NET Profiler. A couple of hints with working profiler sample in compiled and source code forms. Profiler is written using .NET 2.0 version of API.
  5. No Code Can Hide from the Profiling API in the .NET Framework 2.0. Description of new features in 2.0 version of API and working piece of sample code.
  6. Profiler Stack Walking in the .NET Framework 2.0: Basics and Beyond. Piece of theory about Profiling API without working sample. Version 2.0 is covered.
  7. Rewrite MSIL Code on the Fly with the .NET Framework Profiling API, Modifying IL at Runtime, Modifying IL at Runtime (step II), Modifying IL at Runtime (step II+), Modifying IL at Runtime (step III). A set of articles on using .NET Profiling API for generating code at runtime. Covers version 1.0 of API.