I am doing .Net profiler by injecting helper function calls which will again call native function to log it.
So each and every instrumented function will have the following as method body,
FunctionA()
{
//Entry Helper Function
..
..
..
//Exit Helper Function
}
From the above code , the entry and exit functions will have native function call. Inside the native function call i will log the fucntionID and time elapsed etc.,
The problem here is , my native function call (without doing any manipulations) is causing the overhead for about 15% per web request. My sample web request is raising some 2 million function calls and hence those many times the native call happens and that
causes the overhead.
The execution time for a web requests are as follows
1. without profiler attached - 5.6 seconds
2. with profiler attached and with native function calls (native functions are just empty functions) - 7 seconds
3. with profiler attached and commenting native function calls - 5.9 seconds. --> but the helper functions(C#) are called here.
I used "SuppressUnmanagedCodeSecurity" in DllImport , so that the overhead was reduced from 30% to 15%. Still i don't know how to reduce the overhead.
Is there any other ways to calculate the time elapsed and log the function calls for a web request instead of making two native calls(Entry and Exit) for each .Net function..?
Please let me know any other way to profile the .Net web requests.
./Selva