====== Profilowanie - narzędzia VS - notatki ====== Profilowanie dynamiczna analiza programu, która dokonuje pomiaru złożoności czasowej lub/i pamięciowej w czasie jego działania * instrumentacja wstrzykiwanie do kodu instrukcji monitorujących (np. logi, liczniki wywołań, itp.) * profilowanie oparte na zdarzeniach * metody statystyczne, próbkowanie rejestru * symulacja, uruchamianie programu w symulowanym środowisku wirtualnym * Profil: ogólne statystyki zaobserwowanych zdarzeń, np. zliczenie wywołań poszczególnych instrukcji. Raport zazwyczaj zawiera zestawienie kodu z liczbą wywołań. * Ślad (trace), ciąg zaobserwowanych zdarzeń, uwzględnia zależności czasowe także dla programów równoległych. Rozmiar raportu sprawia, że często niepraktyczny w zastosowaniach. Instrumentacja - licznik wywołań - mierzenie czasu Analyze CPU usage data: - ustawić brakpointy - rejestrowanie użycia procesora - czas spędzony w ciele funkcji Memory usage - migawka/snapshot - The Paths to Root tree in the bottom pane displays the objects that reference the type selected in the upper pane - The Referenced Types tree displays the references that are held by the type selected in the upper pane - Pojedyncze instancje (The native memory profiler works by collecting allocation ETW event data emitted during run time. If you are writing your own allocators decorate with _declspec(allocator) Events - Na breakpointach - Na stepach - Pojawiają się przy tym PerfTips – czas wykonania Intellitrace https://docs.microsoft.com/pl-pl/visualstudio/debugger/walkthrough-using-intellitrace?view=vs-2019 Performance Profiler, which is intended to provide analysis for Release builds. In the Performance Profiler, you can collect diagnostic info while the app is running, and then examine the collected information after the app is stopped. Analyze resource consumption and UI thread activity (XAML) In your UWP apps, you can enable UI Analysis in the Diagnostic Tools window. The tool searches for common performance or accessibility issues and displays them in the Events view while you are debugging. In Direct3D apps (Direct3D components must be in C++), you can examine activity on the GPU and analyze performance issues. Sources: * https://docs.microsoft.com/pl-pl/visualstudio/profiling/profiling-feature-tour?view=vs-2019 * https://docs.microsoft.com/pl-pl/visualstudio/profiling/quickstart-cpu-usage-managed?view=vs-2019 * https://docs.microsoft.com/pl-pl/visualstudio/profiling/application-timeline?view=vs-2019