50 likes | 248 Views
Profiling. Where does my application spend the time?. Profiling: W hat, why and how. Dynamic program analysis (we run the program) Not, static program analysis (we look at the source code) Measure time or space (memory) of a running program Why To optimize your program How
E N D
Profiling Where does my application spend the time? Profiling
Profiling: What, why and how • Dynamic program analysis (we run the program) • Not, static program analysis (we look at the source code) • Measure time or space (memory) of a running program • Why • To optimize your program • How • Instrumenting the programing using a tool called a profiler • Instrumentation example: lots of stop watches • After the instrumented program has run you get an analysis report Profiling
Profiling in Visual Studio • Open the solution you want to profile • Get ready for a profiling session • Visual Studio 2013 • Menu Analyze -> Performance and Diagnostics • Visual Studio 2012 • Menu Analyze -> Start Performance Analysis • Your program runs • You get a report • Try to change (optimize) parts of the code • Usually you want to optimize the most time consuming parts of the code • Re-run, and get a new report Profiling
Visual Studio, reading the profiling report • The section “Function Details” is interesting • Tells you which method (aka. Function) has spend most time. • Even which line(s) in the program has spend most time • Example: Gaston Hillar, example 2_11 Profiling
References and further readings • Wikipedia: Profiling (computer programming) • http://en.wikipedia.org/wiki/Profiling_(computer_programming) • MSDN Beginners Guide to Performance Profiling • http://msdn.microsoft.com/en-us/library/ms182372.aspx Profiling