The DNProfiler sample is derived from an "Under The Hood" article by Matt Pietrek on the Microsoft® Developer Network® (MSDN) (msdn.microsoft.com). The source code was modified to support the Shared Source CLI (SSCLI) by removing the dependency on the registry and adding a new environment variable.
Information on the Microsoft® .NET Framework profiling APIs is available in the Profiling.doc file in the Microsoft® .NET Framework SDK, in the Tool Developers Guide\docs directory. Consult the MSDN article for more information on the functionality provided by this sample and the profiling API.
This sample differs from the code described by the MSDN article in the use of COM and the registry. COM registration is replaced by an environment variable, COR_PROFILER_DLL in profiler_on.bat, that contains the path to the DNProfiler.dll on Microsoft Windows®.
The SSCLI version of the sample also does not support the DN_PROFILER_BREAK option, which causes a break point when the profiler is initialized. To obtain similar functionality, set a breakpoint in CProfilerCallback::Initialize(IUnknown * pICorProfilerInfoUnk) in profilercallback.cpp.
To use this sample on UNIX system-based platforms, create a script that sets the same environment variables found in profiling_on.bat. Set the COR_PROFILER_DLL environment variable to contain the path to the libdnprofiler.so dynamic library file.
The sample source is found in sscli\samples\utilities\dnprofiler.
The source files are:
The build output location is %TARGETCOMPLUS%\samples\utilities\dnprofiler. The output file is a dynamic library named:
All samples are built from the buildall script.
You can also build all the
samples by switching to the root of the sample directory, sscli\samples, and typing
build -c.
You can build this specific sample by switching to the sample directory and typing
build -c.
These steps require that the Shared Source CLI (SSCLI) be already built and functional.
set DN_PROFILER_MASK=0x800
The profiler flag values are defined in sscli\palrt\idl\corprof.h.
Copyright (c) 2002 Microsoft Corporation. All rights reserved.