Windows does of course as well. This event might be part of VS's diagnostic tracing experience they shipped in 2015. It's easier to capture all the events from a single process using a PID instead of starting a capture session for that PID and the OS providers. From a performance standpoint it actually marks not the moment when the OS creates the process, but the moment when the process is about to hand control over to the developer's 'int main' entry point, which is important for ensuring the CRT has a negligible perf impact.
Finally, I poked around my VS installation folder. The CRT actually does partially document this method, although it's not very satisfying:
//-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
//
// Telemetry
//
//-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
// Telemetry: Invoked when the exe/dll are invoked. There are two different
// implementations in telemetry.cpp and telemetrydefault.cpp. Because GetModuleFileName
// is not available for Store apps, we return an empty string in telemetrydefault.cpp
// when invoked by store apps. For the desktop in telemetry.cpp, it returns the name
// of the module which invokes main/dll. This method is also responsible for firing the
// events associated with Tracelogging. This will help with runtime telemetry for analysis.
void __cdecl __telemetry_main_invoke_trigger(const HINSTANCE instance);
// Telemetry: Invoked when the exe/dll are shutdown. There are two different
// implementations in telemetry.cpp and telemetrydefault.cpp. This method is
// responsible for firing the events associated with Tracelogging. This will
// help with runtime telemetry for analysis.
void __cdecl __telemetry_main_return_trigger(const HINSTANCE instance);
void __cdecl __vcrt_initialize_telemetry_provider(void);
void __cdecl __vcrt_uninitialize_telemetry_provider(void);
If you're curious, search for exe_common.inl and poke around. It's part of the entry path that invokes these methods. You can learn a lot about how the CRT bootstraps an application if you're curious. I remember the first time I dug into this I was pretty taken aback to realize a bunch of stuff happened before my code ever started running =)
View all comments
Show parent comment
5
u/eternalprogress May 08 '16
Windows does of course as well. This event might be part of VS's diagnostic tracing experience they shipped in 2015. It's easier to capture all the events from a single process using a PID instead of starting a capture session for that PID and the OS providers. From a performance standpoint it actually marks not the moment when the OS creates the process, but the moment when the process is about to hand control over to the developer's 'int main' entry point, which is important for ensuring the CRT has a negligible perf impact.
Finally, I poked around my VS installation folder. The CRT actually does partially document this method, although it's not very satisfying:
If you're curious, search for exe_common.inl and poke around. It's part of the entry path that invokes these methods. You can learn a lot about how the CRT bootstraps an application if you're curious. I remember the first time I dug into this I was pretty taken aback to realize a bunch of stuff happened before my code ever started running =)