La descarga está en progreso. Por favor, espere

La descarga está en progreso. Por favor, espere

Introducción a VTune™ Analizador de rendimiento

Presentaciones similares


Presentación del tema: "Introducción a VTune™ Analizador de rendimiento"— Transcripción de la presentación:

1 Introducción a VTune™ Analizador de rendimiento
Intel Software College

2 Basics of VTune™ Performance Analyzer
Objetivo Al término de este módulo será capaz de: Entender el propósito y modelos soportados por el analizador de rendimiento Vtune™ Identificar “hotspots” explorando a través de las muestras tomadas. Entender como funciona el muestreo Usar “callgraph profiling” para encontrar “hotspots” Basics of VTune™ Performance Analyzer

3 Basics of VTune™ Performance Analyzer
Agenda ¿Qué es el analizador de rendimiento VTune™? Conceptos de afinación del rendimiento Usando el colector de muestras Como funciona el muestreo Muestreando a través del tiempo Gráfico de llamadas Basics of VTune™ Performance Analyzer

4 Analizador de rendimiento VTune™
Ayuda a identificar y caracterizar problemas de rendimiento por medio de: Recolectar datos sobre el rendimiento del sistema que está ejecutando la aplicación. Organizar y desplegar los datos en una variedad de vistas interactivas, desde todo el sistema hasta el código fuente o la perspectiva de instrucción del procesador. Identificar problemas de rendimiento potenciales y sugerir mejoras. Basics of VTune™ Performance Analyzer

5 Basics of VTune™ Performance Analyzer
Ambientes soportados Recolección de datos locales y remotos Perfilar aplicaciones que están ejecutándose en el sistema que tienen el analizador instalado, o Ejecutar experimentos en otros sistemas qué están ejecutando agentes remotos del analizador VTune Basics of VTune™ Performance Analyzer

6 Análisis de rendimiento local
Procesadores Intel® IA-32 Sistema Operativo Microsoft Windows* Linux Procesadores de la familia Itanium® Sistema Operativo Microsoft Windows Basics of VTune™ Performance Analyzer

7 Ambiente Anfitrión/Destino
VTune™ soporta recolección de datos remotos VTune™ instalado en el sistema anfitrión Agente remoto instalado en el sistema destino Sistema Anfitrión Sistema Operativo Windows* Controla el sistema destino Muestra los resultados de la recolección de datos Sistema Destino Familia de procesadores IA-32 o Itanium® Windows o Linux* Intel® PXA2xx procesadores ejecutando Windows CE* Conexión LAN Basics of VTune™ Performance Analyzer

8 Basics of VTune™ Performance Analyzer
Características Muestreo Gráfico de llamadas a funciones (call graph) Basics of VTune™ Performance Analyzer

9 El muestreo obtiene datos del rendimiento de todo el sistema
Características del analizador VTune™ y modelos de su utilización El muestreo obtiene datos del rendimiento de todo el sistema Basics of VTune™ Performance Analyzer

10 Características del analizador VTune™ y modelos de su utilización
El muestreo sobre el tiempo muestra como los datos del muestreo cambian a través del tiempo Basics of VTune™ Performance Analyzer

11 Muestreando el código fuente con datos del rendimiento
Características del analizador VTune™ y modelos de su utilización Muestreando el código fuente con datos del rendimiento Basics of VTune™ Performance Analyzer

12 Características del analizador VTune™ y modelos de su utilización
El gráfico de llamadas obtiene y muestra información sobre el flujo del programa en la aplicación Basics of VTune™ Performance Analyzer

13 Basics of VTune™ Performance Analyzer
¿Qué es un Hotspot? Es donde en una aplicación donde hay una cantidad significativa de trabajo Donde = dirección en memoria => Proceso SO => Hilo SO => archivo ejecutable o módulo => función de usuario (requiere símbolos) => línea de código fuente (requiere símbolos con números de línea) o instrucción del procesador (ensamblador) Significativa = actividad que ocurre frecuentemente, probablemente no tiene mucho impacto en el rendimiento del sistema Actividad = tiempo gastado en otros eventos internos del procesador Ejemplos de otros eventos: fallos de caché, fallos en la predicción de saltos, instrucciones de punto flotante retiradas, etc. What Is a Hotspot? What is the difference between a hotspot and a bottleneck? A hotspot is where to focus your attention when looking for bottlenecks. If the bottleneck is micro-architectural, then finding a hotspot is really important! ACTIVITY IS NOW OVERLOADED IS THERE A BETTER WORD Basics of VTune™ Performance Analyzer

14 Muestreo: El método estadístico para encontrar los Hotspots
El colector de muestras Periódicamente interrumpe el procesador Basado en tiempo Basado en eventos: Activado por la ocurrencia de cierto número de eventos de la microarquitectura Recolecta el contexto de ejecución Dirección de ejecución en memoria (CS:IP) Identificador del proceso en el sistema operativo e hilo Módulo ejecutable cargado en esa dirección Si hay símbolos para el módulo, el post-procesamiento puede identificar la función o método en la dirección de memoria. Los números de línea del archivo de símbolos pueden direccionarte a la línea relevante del código fuente. Basics of VTune™ Performance Analyzer

15 Recolector de muestras
Periódicamente interrumpe el procesador para obtener el contexto de ejecución Muestreo basado en tiempo (TBS) se activa por: Servicios del timer del sistema operativo Cada n ciclos de reloj del procesador Muestreo basado en eventos (EBS) se activa por eventos del procesador Estos eventos son específicos del procesador, como fallos en la caché L2, fallos en la predicción de saltos, instrucciones de punto flotante retiradas, etc. Sampling Collector Sampling works by the principle of statistical inference. The number of samples attributed to a particular location infers the proportion of the predicating activity at that location. Using statistical inference to calculate the exact confidence one should have in that conclusion is not particularly relevant to this application. It is sufficient to say that if a predicating event occurs often enough to be of interest in determining a hotspot, the location of that event will receive a proportion of the samples that would be deemed significant by casual observation. This is true provided that a reasonable number of samples are gathered. Engineering has determined that sampling at any rate on the order of magnitude of about 1,000 for every second of execution time is more than reasonable to achieve practical utility from this technique. Thus we need not dwell on the statistical analysis! (NMI or RTC) Basics of VTune™ Performance Analyzer

16 Resultados de muestras por proceso del Sistema Operativo
Analizador VTune™ Recolector de muestras Resultados de muestras por proceso del Sistema Operativo Este proceso del sistema operativo tiene la mayor cantidad de muestras de ciclos de reloj Ordenado por ciclos de reloj Basics of VTune™ Performance Analyzer

17 Muestra solo la muestra de datos de ciclos de reloj.
Presiona aquí para ver en el tiempo. Analizador VTune™ Recolector de muestras Presiona aquí para ver los procesos del SO Muestra solo la muestra de datos de ciclos de reloj. Basics of VTune™ Performance Analyzer

18 Basics of VTune™ Performance Analyzer
Analizador VTune™ Recolector de muestras Presiona aquí para separar por CPU Esta gráfica fue filtrada seleccionando solo un elemento de la gráfica de procesos Basics of VTune™ Performance Analyzer

19 Basics of VTune™ Performance Analyzer
Analizador VTune™ Recolector de muestras Vista de Tabla: Seleccionar Resumen de la línea señalada en la tabla. Basics of VTune™ Performance Analyzer

20 Basics of VTune™ Performance Analyzer
Analizador VTune™ Recolector de muestras Vista del Hotspot de un módulo para todos los procesos e hilos del SO agrupados por función (o método). Basics of VTune™ Performance Analyzer

21 Basics of VTune™ Performance Analyzer
Analizador VTune™ Recolector de muestras Basics of VTune™ Performance Analyzer

22 Presiona aquí para Ver código desensamblado
Analizador VTune™ Recolector de muestras Presiona aquí para Ver código desensamblado Totales por Linea Fuente Actividad en Localidades de Instrucciones Basics of VTune™ Performance Analyzer

23 Acercar Alejar Activity at Instruction Locations
Analizador VTune™ Recolector de muestras Acercar Alejar Totals for Source Line Activity at Instruction Locations Seleccionar Evento Intervalos de tiempo en rojo tienen más muestras Basics of VTune™ Performance Analyzer

24 Actividad 1: Encontrar el Hotspot
Aprender como identificar hotspots con el analizador VTune™. Basics of VTune™ Performance Analyzer

25 Tres Beneficios Claves del Muestreo
No es necesario modificar código. Pero compila/encadena con símbolos y números de línea. Haz ejecutables finales (release) con optimizaciones. El muestreo es muy amplio en cuanto a sistemas. No solo NUESTRA aplicación. Puede verse actividad en el código del sistema operativo incluyendo drivers. La sobrecarga por muestrear es muy baja. La validez es mayor cuando la perturbación es baja. La sobrecarga puede reducirse aún más quitando el progreso la interfaz de usuario. ¿De qué otra forma puede reducirse la sobrecarga del muestreo? Basics of VTune™ Performance Analyzer

26 Como Funciona el Muestreo Basado en Eventos (EBS) Diagrama Conceptual
Selecciona Señal del Evento Cuenta Decreciente Número “Muestrea Después” Underflow a Cero Interrumpe CPU para Tomar Muestra How Event-based Sampling (EBS) Works Break the news to the students that EBS does not work on laptops. It does not work on non-Intel® processors either. Controlador Interno de Interrupciones§ Como seleccionar un número “Muestreo Después” Basics of VTune™ Performance Analyzer

27 ¿Cuántas Muestras Son Suficientes?
¿Un millón de muestras por una ejecución de 5 segundos? ¿Se tienen suficientes muestras para ser estadísiticamente significativas? ¿Cuánta sobre carga se está causando? ¿Qué si solo se obtienen 100 muestras? ¿Qué sucede si se muestrea después de un evento? ¿Se está obteniendo un buen perfil? Aproximadamente 1,000 muestras por segundo es un buen balance entre significativo y sobrecarga Basics of VTune™ Performance Analyzer

28 Objetivo: 1,000 Muestras Por Segundo
¿Cuál es la muestra después de valor por ciclo de reloj? Depende de la velocidad del reloj de CPU RESPUESTA: La velocidad de reloj del CPU en KHz Si la velocidad de reloj del CPU = 1,400,000,000 Hz Muestrear después de 1,400,000 ciclos ¿Qué es la muestra después de un valor de fallos de caché L2? Depende en que tan frecuente hay un fallo en la caché L2 ¿Definición circular? ¿No es lo que se está tratando de determinar? Haz una estimación inteligente ¿Más o menos frecuente que los ciclos de reloj? ¿10 veces? ¿100 veces? ¿1000 veces? Basics of VTune™ Performance Analyzer

29 Basics of VTune™ Performance Analyzer
Calibración Establecer el muestreo después de un valor para obtener un número de muestras razonable. ~1000 muestras por segundo por CPU lógico Requieres que la carga de trabajo sea ejecutada dos veces Calibración Manual: Quita la marca de Calibrate Sample After Encontrada en el diálogo Advanced Activity Configuration Inicia con el valor por default o una estimación Ejecuta una prueba Modifica la muestra después del valor y vuelve a probar Trata de obtener aproximadamente 1000 muestras por segundo por CPU lógico Basics of VTune™ Performance Analyzer

30 Muestreo a Través del Tiempo
Muestra como distribuciones de las muestras cambian a través del tiempo por proceso, hilo, o módulo Acercamiento en regiones de tiempo Útil para: Identificar características de rendimiento variables en el tiempo Entender el comportamiento de los hilos Basics of VTune™ Performance Analyzer

31 Muestreo Sobre el Tiempo
Colecta los datos del muestreo Selecciona elementos de interés desde el proceso, hilo o módulos Presiona Selecciona la región de interés Presiona para ver histograma del proceso/hilo/direcciones para una región de tiempo Basics of VTune™ Performance Analyzer

32 Actividad 2: Muestreo en el Tiempo
Aprender como usar la vista de Muestreo Sobre el Tiempo Basics of VTune™ Performance Analyzer

33 Perfil de Gráfico de Llamadas
Rastrea la entrada de la función y puntos de salida del código durante la ejecución Usa instrumentación binaria Usas esos datos para determinar el flujo del programa, funciones críticas y secuencias de llamadas a subrutinas No cualquier sistema: Solo perfila códigos en la ruta de llamadas de la aplicación en Ring 3 Call Graph Profiling Speak about Ring 0 and Ring 3 In current IA-32 architecture, all software runs in one of four “privilege levels” or “rings” (Ring-0 through Ring-3). The OS traditionally runs in Ring-0, which affords privileged access to the widest range of processor and platform resources. Individual applications usually run in Ring-3, which restricts certain functions (such as memory mapping) that might impact other applications. In this way, the OS retains control to ensure smooth operation. Since the VMM must have privileged control of platform resources, the usual solution is to run the VMM in Ring-0, and guest OSs in Ring-1 or Ring-3. However, today’s OSs have been specifically designed to run in Ring-0. This creates certain challenges. In particular, there are 17 “privileged” instructions that control critical platform resources. These instructions are used occasionally in most existing OS versions. When an OS is not running in Ring-0, any one of these instructions can create a conflict, causing either a system fault or a wrong response. Basics of VTune™ Performance Analyzer

34 Basics of VTune™ Performance Analyzer
¿Qué se puede perfilar? Aplicaciones Win32 Stand-alone Win32* DLLs Stand-alone COM+ DLLs Aplicaciones Java Aplicaciones .NET* Aplicaciones ASP.NET Aplicaciones Linux32* Basics of VTune™ Performance Analyzer

35 Vista del Gráfico de Llamadas
Filtrado por “self time” Las líneas rojas muestran la ruta crítica. La ruta crítica es la ruta de llamadas que más tiempo consume. Basada en el parámetro “self time”. Los nodos en naranja indican funciones con el mayor “self time”. Basics of VTune™ Performance Analyzer

36 Ventana del Gáfico de Llamadas
Usa la ventana de navegación del gráfico para ver el gráfico de llamadas completo. Basics of VTune™ Performance Analyzer

37 Gráfico de Llamadas Vista de Lista de Llamadas
Aquí Intercambia entre lista de llamadas y vista del gráfico de llamadas. Basics of VTune™ Performance Analyzer

38 Métricas del Gráfico de Llamadas (Call Graph)
Métrica de Rendimiento Descripción Self Time Tiempo total en una función, excluyendo el tiempo gastado en sus hijos (incluye tiempo de espera) Total Time Tiempo medido desde que inicia una función hasta que sale de la función Total Wait Time Tiempo gastado en una función y su hijo cuando el hilo se bloquea Wait Time Tiempo gastado en una función cuando el hilo se bloquea (excluye el tiempo bloqueado en su hijo) Calls Número de veces que se llama la función Metrics Wait time is not collected unless the application is multithreaded. Basics of VTune™ Performance Analyzer

39 Actividad 3: Gráfico de Llamadas
Encuentra el hotspot en el programa gzip usando el gráfico de llamadas. Basics of VTune™ Performance Analyzer

40 Muestreo Versus Gráfico de Llamadas
Menor Sobrecarga Mayor Sobrecarga Todo el Sistema En el árbol de llamadas de la aplicación solo Ring 3 Histograma de direcciones de todo el sistema Muestra nivel de jerarquía de funciones con contadores de llamadas, tiempos y ruta crítica Para niveles de detalles de función, debe tener información de debug Debe re-encadenar con el parámetro /fixed:no, no hace la instrumentación de manera automática El muestreo puede basarse en el tiempo y otros eventos del procesador Los resultados se basan en el tiempo. Sampling Versus Call Graph (Clean up and compare with on-line help, color good items green and red bad, and so on.) Which is better? Depends upon the data that you need, not the application It is almost always better to start with sampling. Why? No build changes Lowest possible overhead You can see the whole system, in case there is something unexpected Sampling overhead can be reduced by increasing the sample after count or disabling the progress meter. Basics of VTune™ Performance Analyzer

41 Aplicaciones Java* y .NET*
Proveen datos de rendimiento para código administrado y código no administrado Da una idea de cómo llamadas de código administrado se traducen en llamadas Win32 * Usa API de perfiles de código administrado e instrumentación binaria Basics of VTune™ Performance Analyzer

42 Lo Básico del Analizador de Rendimiento VTune™ Lo Qué se ha Cubierto
Se pueden usar los diferentes perfiladores en el analizador Vtune para entender diferentes aspectos del rendimiento de una aplicación. Basics of VTune™ Performance Analyzer

43 Basics of VTune™ Performance Analyzer
This should always be the last slide of all presentations. Basics of VTune™ Performance Analyzer

44 Diapositivas Adicionales

45 Counter Monitor Tracks Operating System Counters Over Time
VTune™ Analyzer Features and Usage Models Counter Monitor Tracks Operating System Counters Over Time Basics of VTune™ Performance Analyzer

46 The Tuning Assistant Provides Tuning Advice Based on Performance Data
VTune™ Analyzer Features and Usage Models The Tuning Assistant Provides Tuning Advice Based on Performance Data Basics of VTune™ Performance Analyzer

47 Intel® Tuning Assistant
Identifies bottlenecks in: Pentium® 4, Pentium M®, Itanium® 2, and Pentium® III processors. Uses EBS and Counter Monitor data. Shows scaling differences between different runs. Code Coach is still available but is not enabled by default. Intel® Tuning Assistant The tuning assistant in 6.1 uses Automatic Hotspot Analysis technology. It finds micro architectural bottlenecks in Pentium® III, Pentium 4, and Intel® Xeon™ processors. If Hyper-Threading Technology (HT technology) is enabled, then it uses the HT Technology knowledge base and you should collect the events in the Performance Tuning for Hyper Threading group. If HT Technology is disabled, then it uses the Pentium 4 knowledge base and you should collect the events in Performance Tuning Primary events group. If you try to use the Tuning assistant and collect the events in Performance Tuning Primary and HT Technology is enabled, it will say it does not recognize any of the events (this will be fixed). The code coach is also still available. You can enable it by going to configure-> options->Intel Tuning Assistant->Source Info->Uncheck disable source level. Source level advice only works on Windows*. AHA works on Windows and Linux*. Basics of VTune™ Performance Analyzer

48 Intel® Tuning Assistant
Now we skip to the last item on the What’s New list. We’ve already talked about the items in between, right? Totally revamped Tuning Assistant (Code coach) Improved intelligence Allows you to see the advice and code at the same time, so you can make more sense of the advice. System-wide advice based on gathered performance data. Counter Monitor advice is also available. Basics of VTune™ Performance Analyzer

49 Intel® Tuning Assistant
VTune™ analyzer automatically selects events in the Sampling wizard. Basics of VTune™ Performance Analyzer

50 Intel® Tuning Assistant
For more detail, click hyperlink. Basics of VTune™ Performance Analyzer

51 Lab Activity 3: Getting Tuning Advice
Learn how to get processor-specific tuning advice Basics of VTune™ Performance Analyzer

52 Windows* Command Line Interface
Collect sampling data from the command line. Useful for integrating performance data collection into your automated regression testing. View the data in the VTune™ Performance Analyzer or export as ASCII text. Invoke by typing “vtl” at the command line. Basics of VTune™ Performance Analyzer

53 Windows* Command Line Interface
Creates hidden project structure To create an activity: vtl create [activity name] + options To run an activity: vtl run [activity name] To view activities type: vtl show To view results of a particular activity type: vtl view [activityname::result] [options] To delete the entire project: vtl delete –all To delete a specific activity: vtl delete <activity name> Basics of VTune™ Performance Analyzer

54 Windows* Command Line Interface Examples
Sample on clockticks and instructions retired and launch app matrix.exe: vtl activity a1 –c sampling –app matrix.exe run See the clocktick hotspots in matrix.exe: vtl view a1::r1 –hf –mn matrix.exe See the number of samples in each module system wide: vtl a1::r1 view –modules Basics of VTune™ Performance Analyzer

55 Windows* Command Line Interface Help
For general command line arguments: vtl –help For sampling command line arguments and events: vtl –help –c sampling For in depth help and examples go to: Start->Programs- >Intel® VTune™ Performance Analyzer->Help for the Command Line Basics of VTune™ Performance Analyzer

56 Lab Activity 4: Using the Windows* Command Line Interface
Learn how to collect sampling data from the command line Basics of VTune™ Performance Analyzer

57 Call Graph Advanced Configuration
Set instrumentation levels. Helps control overhead Select which functions are instrumented. Basics of VTune™ Performance Analyzer

58 Call Graph Advanced Options
This is the instrumented module status grid. Click here to set module instrumentation levels. Advanced Options This screen displays the instrumentation status of all the different modules. You can also specify where the instrumented module is placed and what its name will be on a one on one basis. However, to use the same name and location in place, instrumentation must be checked in the advanced options box. Clicking the Instrument now button will instrument all the modules listed here. Click on a module in the grid and then click the Functions button to pick which functions to instrument. Basics of VTune™ Performance Analyzer

59 Instrumentation Levels
Description Debug Info Required? All Functions Every function in the module is instrumented. Yes Custom You can specify which functions are instrumented Export Every function in the module’s export table is instrumented. No Minimal The module is instrumented but no data is collected for it. Basics of VTune™ Performance Analyzer

60 More Advanced Call Graph Options
Cache directory location This is useful for long runs and very large applications. If you do not set this, the machine might run low on memory. More Advanced Call Graph Options The collection buffer size controls how often call graph writes data to drives. Inplace instrumentation allows you to overwrite original module locations. This does not work for system dlls on Windows* XP. Inplace instrumentation must be checked if you select Use original module location and Use original module name. Allow call graph to instrument COM interfaces. Basics of VTune™ Performance Analyzer

61 Basics of VTune™ Performance Analyzer
Function Selection Click here to enable or disable instrumentation for a particular function. Basics of VTune™ Performance Analyzer

62 Use Sampling and Call Graph Together
Use sampling to find which functions have hotspots. Use call graph to find out who is calling these functions. Basics of VTune™ Performance Analyzer

63 Lab Activity 6: Using Sampling and Call Graph Together
Optimize an application (linpack) using sampling and call graph Basics of VTune™ Performance Analyzer

64 Sampling and Call Graph Have Different Hotspots?
Self time includes blocked time. Event-based sampling (EBS) and time-based sampling (TBS) do not include blocked time in functions (this usually appears in processor.sys). Hotspots should be the same for self time – wait time (this is non-blocked self time). Basics of VTune™ Performance Analyzer

65 What Counter Monitor Does
Collects hardware and software performance counter data Windows* Perfmon* counters Performance DLL SDK Correlate counter data with sampling data Basics of VTune™ Performance Analyzer

66 Basics of VTune™ Performance Analyzer
Performance DLL SDK SDK for creating custom performance counters that can be used by counter monitor Available on the Intel® web site Example: performance counter that measures the transactions per second for a server application Basics of VTune™ Performance Analyzer

67 Basics of VTune™ Performance Analyzer
Performance DLL SDK SDK for creating custom performance counters that can be used by counter monitor Example: performance counter that measures the transactions per second for a server application Basics of VTune™ Performance Analyzer

68 Basics of VTune™ Performance Analyzer
Monitor Window Click to highlight different counter data in the graph. Basics of VTune™ Performance Analyzer

69 To Correlate Sampling Data
Click the highlight icon and highlight a time slice by dragging over the graph from left to right. Click on the drill icon. You should now see the sampling data for that time slice. Basics of VTune™ Performance Analyzer

70 Lab Activity 7: Counter Monitor
Use counter monitor to analyze gzip Basics of VTune™ Performance Analyzer

71 Basics of VTune™ Performance Analyzer
Trigger API Allows you to create your own mechanism to programmatically trigger performance counter data collection Example: collect counter monitor data every time a frame is rendered Basics of VTune™ Performance Analyzer


Descargar ppt "Introducción a VTune™ Analizador de rendimiento"

Presentaciones similares


Anuncios Google