vtune™ performance analyzer 6.0

36
VTune™ Performance VTune™ Performance Analyzer 6.0 Analyzer 6.0

Upload: kert

Post on 11-Jan-2016

127 views

Category:

Documents


0 download

DESCRIPTION

VTune™ Performance Analyzer 6.0. 目标. 能够使用 VTune 分析 软件的性能瓶颈. AGENDA. Introduction Terminology Sampling Call Graph Counter Monitor VTune on Linux. VTune ™ Performance Analyzer. 帮助你找出性能方面问题 Bottlenecks in algorithms Bottlenecks due to data layout Application architecture bottlenecks - PowerPoint PPT Presentation

TRANSCRIPT

Page 1: VTune™ Performance Analyzer 6.0

VTune™ Performance VTune™ Performance

Analyzer 6.0Analyzer 6.0

Page 2: VTune™ Performance Analyzer 6.0

目标目标

能够使用能够使用 VTuneVTune 分析分析软件的性能瓶颈软件的性能瓶颈

Page 3: VTune™ Performance Analyzer 6.0

AGENDAAGENDA

Introduction Introduction TerminologyTerminology SamplingSampling Call GraphCall Graph Counter MonitorCounter Monitor VTune on LinuxVTune on Linux

Page 4: VTune™ Performance Analyzer 6.0

VTune™ Performance VTune™ Performance AnalyzerAnalyzer帮助你找出性能方面问题帮助你找出性能方面问题

• Bottlenecks in algorithmsBottlenecks in algorithms

• Bottlenecks due to data layoutBottlenecks due to data layout

• Application architecture Application architecture bottlenecksbottlenecks

• System-Level and hardware System-Level and hardware bottlenecksbottlenecks

Page 5: VTune™ Performance Analyzer 6.0

AGENDAAGENDA

IntroductionIntroduction TerminologyTerminology SamplingSampling Call GraphCall Graph Counter MonitorCounter Monitor VTune on LinuxVTune on Linux

Page 6: VTune™ Performance Analyzer 6.0

什么是 什么是 Hotspot?Hotspot? WhereWhere in an application/system where there is a in an application/system where there is a

significantsignificant amount of amount of activityactivity(( 有大量活动发生的有大量活动发生的地方地方 )) WhereWhere = = address in memory => OS process => OS address in memory => OS process => OS

thread => executable file or thread => executable file or ModuleModule => user => user function (requires symbols) => line of source function (requires symbols) => line of source code (requires symbols with line numbers) or code (requires symbols with line numbers) or processor (assembly) instruction.processor (assembly) instruction. ((定位到指令)定位到指令)

SignificantSignificant = if it doesn’t happen often it probably = if it doesn’t happen often it probably doesn’t have much impact on the system’s doesn’t have much impact on the system’s performance.performance.

ActivityActivity = time spent or other internal processor = time spent or other internal processor event.event.

Page 7: VTune™ Performance Analyzer 6.0

什么是什么是 Hotspot?Hotspot?

hotspothotspot 是你的代码花费很长时间执行的区域。是你的代码花费很长时间执行的区域。 通过定位通过定位 hotspothotspot ,, VTuneVTune 性能分析工具可以性能分析工具可以

帮助你分析应用程序的性能。帮助你分析应用程序的性能。 但是简单的知道但是简单的知道 hotspothotspot 的位置是不够的,你必的位置是不够的,你必

须知道什么导致须知道什么导致 hotspothotspot 的产生,怎样改进的产生,怎样改进 通过对热区的进一步分析,你可以跟踪关键的函通过对热区的进一步分析,你可以跟踪关键的函

数调用,监控特殊的处理器事件,如数调用,监控特殊的处理器事件,如 cache cache missmiss

Page 8: VTune™ Performance Analyzer 6.0

HotspotHotspot 与与 BottleneckBottleneck 的区的区别别

BottleneckBottleneck 是系统中性能受到约束的是系统中性能受到约束的位置位置

VTune™ Performance AnalyzerVTune™ Performance Analyzer 帮帮助你找到并删除助你找到并删除 BottlenecksBottlenecks..

找到软件找到软件 HotspotsHotspots 是一个分析方法,是一个分析方法,帮助你定位帮助你定位 BottlenecksBottlenecks..

Page 9: VTune™ Performance Analyzer 6.0

性能优化方法性能优化方法

Page 10: VTune™ Performance Analyzer 6.0

三种数据收集器三种数据收集器

samplingsampling call graphcall graph counter monitorcounter monitor

Page 11: VTune™ Performance Analyzer 6.0

Two Ways toTwo Ways toTrack LocationTrack Location

Problem:Problem: 我需要知道你在哪花费了多长时间我需要知道你在哪花费了多长时间 Statistical Solution:Statistical Solution: 我每我每 3030 分钟呼叫你分钟呼叫你 Instrumentation Solution:Instrumentation Solution: 每个地方有一个特每个地方有一个特

殊的电话点,你每到一个地点向我报告殊的电话点,你每到一个地点向我报告

Page 12: VTune™ Performance Analyzer 6.0

The Statistical The Statistical Solution: I Call You!Solution: I Call You!

ADVANTAGES:ADVANTAGES: 低开销低开销 : : 没有太多的中断没有太多的中断 没有建站点的开销没有建站点的开销 无论你在那里都能精确定位无论你在那里都能精确定位

DISADVANTAGES:DISADVANTAGES: 如果你的双手拿满东西,我必须等待如果你的双手拿满东西,我必须等待 你可能第一次没有听到铃声,所以我不能精确确你可能第一次没有听到铃声,所以我不能精确确

定我呼叫你时,你在那里定我呼叫你时,你在那里由于你不经常去有一些地方,我可能根本不知道你去过

Page 13: VTune™ Performance Analyzer 6.0

The Instrumentation The Instrumentation Solution: You call me Solution: You call me when you get there!when you get there! ADVANTAGES:ADVANTAGES:

• 你到达新的地方我能立刻知道你到达新的地方我能立刻知道• 我知道你在一个地方呆了多长时间我知道你在一个地方呆了多长时间• 我知道你到达同一个地方多少次我知道你到达同一个地方多少次

DISADVANTAGES:DISADVANTAGES:• 不知道你在街道内做了什么不知道你在街道内做了什么• 粒度:站点粒度:站点• 浪费了大量时间打电话浪费了大量时间打电话• 建立站点扩大了街道空间建立站点扩大了街道空间

Page 14: VTune™ Performance Analyzer 6.0

识别识别 HotspotsHotspots Sampling Data CollectorSampling Data Collector – The Statistical – The Statistical

SolutionSolution 描述执行的一个侧面(柱状图)描述执行的一个侧面(柱状图) 低开销低开销

Call Graph Data CollectorCall Graph Data Collector– The – The Instrumentation SolutionInstrumentation Solution 函数的时间信息函数的时间信息 函数调用者和被调用者的关系函数调用者和被调用者的关系 比比 samplingsampling 的开销高的开销高

Page 15: VTune™ Performance Analyzer 6.0

三种性能监控方式的比较三种性能监控方式的比较

Page 16: VTune™ Performance Analyzer 6.0

VTune™ VTune™ ProjectsProjects

什么是 什么是 ProjectProject ?? ProjectProject 由一个或多个由一个或多个 ActivitiesActivities 组成组成

什么是什么是 ActivityActivity ? ? 包含你应用程序的信息和希望运行的数据收集包含你应用程序的信息和希望运行的数据收集

器信息器信息

Page 17: VTune™ Performance Analyzer 6.0

Projects are organized like Projects are organized like this:this:

Page 18: VTune™ Performance Analyzer 6.0

AGENDAAGENDA

Introduction / What’s New in 6.0Introduction / What’s New in 6.0 TerminologyTerminology SamplingSampling Call GraphCall Graph Counter MonitorCounter Monitor VTune on LinuxVTune on Linux

Page 19: VTune™ Performance Analyzer 6.0

Sampling TechnologySampling Technology 打断处理器的执行,获得执行上下文打断处理器的执行,获得执行上下文

中断可以是周期性的中断可以是周期性的 , , 如每秒如每秒 1,0001,000 次次采样采样

采样的触发 采样的触发 Event Based Sampling Event Based Sampling (EBS).(EBS). 采样事件:处理器相关事件,如采样事件:处理器相关事件,如 L2 Cache L2 Cache

Misses, Branch Mispredictions, Floating-Misses, Branch Mispredictions, Floating-point instructions retired, etc.point instructions retired, etc.

Page 20: VTune™ Performance Analyzer 6.0

Lab 1: gzip Sampling Lab 1: gzip Sampling AnalysisAnalysis

Introduces EBS and Sampling UIIntroduces EBS and Sampling UI gzip is an open source file compression gzip is an open source file compression

programprogram

Page 21: VTune™ Performance Analyzer 6.0

Select New ProjectSelect New Project

Page 22: VTune™ Performance Analyzer 6.0

Select Sampling Wizard Select Sampling Wizard and then OKand then OK

Page 23: VTune™ Performance Analyzer 6.0

Select Win32*/Win64*/Linux* Select Win32*/Win64*/Linux* Profiling radio button and then OKProfiling radio button and then OK

Page 24: VTune™ Performance Analyzer 6.0

Remember each Activity has Remember each Activity has its own its own Application/Module Application/Module ProfileProfile

1.1. Browse to the Browse to the application: application: gzip.exegzip.exe

2.2. The command The command line arguments line arguments are: -f are: -f testfile.dattestfile.dat

3.3. Check Modify Check Modify default default configurationconfiguration

4.4. Click on FinishClick on Finish

Page 25: VTune™ Performance Analyzer 6.0

Modify the Sampling Modify the Sampling ActivityActivity

1.1. Select the Select the Sampling Sampling check box.check box.

2.2. Click on Click on ConfigureConfigure

Page 26: VTune™ Performance Analyzer 6.0

Uncheck Calibrate Sample Uncheck Calibrate Sample After Value checkboxAfter Value checkbox

Why Why do do this?this?

Page 27: VTune™ Performance Analyzer 6.0

Click OK to run the activityClick OK to run the activity

Page 28: VTune™ Performance Analyzer 6.0

根据采样次数找到根据采样次数找到 hotspothotspot

Page 29: VTune™ Performance Analyzer 6.0

AGENDAAGENDA

Introduction / What’s New in 6.0Introduction / What’s New in 6.0 TerminologyTerminology SamplingSampling Call GraphCall Graph Counter MonitorCounter Monitor VTune on LinuxVTune on Linux

Page 30: VTune™ Performance Analyzer 6.0

根据总时间找到关键路径根据总时间找到关键路径

Page 31: VTune™ Performance Analyzer 6.0

AGENDAAGENDA

Introduction / What’s New in 6.0Introduction / What’s New in 6.0 TerminologyTerminology SamplingSampling Call GraphCall Graph Counter MonitorCounter Monitor VTune on LinuVTune on Linu

Page 32: VTune™ Performance Analyzer 6.0

根据占处理器时间找根据占处理器时间找 hotspothotspot

Page 33: VTune™ Performance Analyzer 6.0

修改代码进行优化修改代码进行优化

Page 34: VTune™ Performance Analyzer 6.0

AGENDAAGENDA

Introduction / What’s New in 6.0Introduction / What’s New in 6.0 TerminologyTerminology SamplingSampling Call GraphCall Graph Counter MonitorCounter Monitor VTune on LinuxVTune on Linux

Page 35: VTune™ Performance Analyzer 6.0

VTune on LinuxVTune on Linux

在在 LinuxLinux 上安装上安装 Sampling DriverSampling Driver 在在 LinuxLinux 上启动上启动 VTune serverVTune server 在在 WindowsWindows 上进行远程收集上进行远程收集

Page 36: VTune™ Performance Analyzer 6.0

链接链接

http://www.intel.com/software/products/http://www.intel.com/software/products/college/vtune/getstart/tutorial/index.htmcollege/vtune/getstart/tutorial/index.htm