Hi,
I would like to trace performance inside a c# mobile application, in order to know the amount of time needed by some long-running methods. The goal is to know the performance at the level of methods. This tracing would be decided at runtime.
First idea that came is to maintain a global variable "doWeHaveToTrace", to check it each time a potentialy tracable method is called, and trace it if that variable is true. And in this case, i probably would use a Logger or a TraceListener to write tracing infos into a file.
But i think this mechanism is quite heavy, because a variable has to be checked in each method, and the logger calls have to be coded.
I also thought about aspect programming (insert tracing code in before() and after() methods), but i don't think aspect programming could be allowed inside this project.
So i was wondering, is there any other good mechanisms that could provide such performance tracing ? Is it possible to trace a whole method ? And to decide to stop or resume tracing at runtime ?
I hope i was clear, Thanks