Upload
martin-kulov
View
3.055
Download
0
Embed Size (px)
DESCRIPTION
Citation preview
www.devreach.com
Demystifying Visual Studio 2012 Performance Tools
Martin Kulov | kulov.net
www.devreach.com
You cannot manage,What you do not measure
www.devreach.com
You cannot Improve,What you do not measure
www.devreach.com
Operating System
Trace Analysis
HDD RAM CPU LAN
Win32 API
CLR WinRT
CPU Counters
COM
Our code
www.devreach.com
CPU Counters
• Hardware events – portable and platform– Instructions Retired– Non Halted Cycles– ITLB Misses– Branches Retired– Mis-predicted Branches– L2 Cache Read Misses– L2 Cache Read References
www.devreach.com
Operating System
Trace Analysis
HDD RAM CPU LAN
Win32 API
CLR WinRT Windows
Perf
Counters
CPU Counters
COM
Our code
www.devreach.com
Windows Performance Counters
• They are …counters• Min interval – 1sec• Apps and kernel send Increment
signals• Accessed by Windows API
www.devreach.com
Perf Counters Demo
www.devreach.com
Operating System
Trace Analysis
HDD RAM CPU LAN
Win32 API
CLR WinRT Windows
Perf
Counters
CPU Counters
Event
Tracing
for
Windows
COM
Our code
www.devreach.com
Event Tracing for Windows
• General purpose, high speed tracing• Buffering and logging in kernel• Faster than printf
– 20,000 events per second while only using 5% CPU load on a P3 500MHz!
• Provider, Consumer, Controller model• Over 700 providers in Win7, ~900 in
Win8!• Aggregates all sources• Stack walking (on kernel events)
www.devreach.com
ETW Kernel Providers
• Hardware Configuration Events • Disk-level I/O • File-level I/O • Image Layouts• Page Faults• Network I/O • Registry I/O • Process and Thread info
www.devreach.com
ETW Application Providers
• Windows Firewall• WLAN, LAN• USB, Bluetooth• IIS, ASP.NET, CLR, HTTP.SYS• Security• … many more
www.devreach.com
ETW Demo
www.devreach.com
Side note: Symbols
• _NT_SYMBOL_PATH=SRV*c:\mss*http://msdl.microsoft.com/download/symbols
• Call stack information• Private managed code fields• Link to source code repository
www.devreach.com
Concurrency Visualizer
• Utilization• Threads• Cores• Stack Walking
www.devreach.com
Operating System
Trace Analysis
HDD RAM CPU LAN
Win32 API
CLR WinRT Windows
Perf
Counters
CPU Counters
Event
Tracing
for
Windows
COM
Our code
Profiler
www.devreach.com
Profiler
• Instrumentation• Sampling• Concurrency• Stack Walking
www.devreach.com
Profiler setup
• There can be only one• Uses environment variables– COR_ENABLE_PROFILING– COR_PROFILER – COR_XXX…
• Profiler API
www.devreach.com
Instrumentation
• Profiler based• Requires full code recompilation• Best during development phase• Complete execution path
www.devreach.com
Sampling
• Profiler based• Data collection on sample intervals• Suitable for long runs• Call Stack
www.devreach.com
Concurrency
• Show resource contention• Based on Detours• Microsoft Research project now sold
for $10k• http://research.microsoft.com/en-us/projects/deto
urs/
• Stack Walking
www.devreach.com
Profiling extras
• GC, Allocation• Tier Interaction• JavaScript• Production use• Licensing
www.devreach.com
Profiler Demo