Profiles (using the profiling API) are "external" components (not exactly COM) in the sense that they are loaded by the CLR and have various options for calling the invoked method of any enter / leave / tail method in managed code (and many other things). They are written in unmanaged code.
AFAIK there is no way to get this information internally without accessing the profiler / debugger that monitors the CLR. Also remember that you cannot always get such information, since part of it exists only after your code completes (many Dispose () calls, completion, etc.).
source share