"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
06 intel v_tune_session_08
1. Code Optimization and Performance Tuning Using Intel VTune
Installing Windows XP Professional Using Attended Installation
Objectives
• In this session, you will learn to:
Identify system-level performance issues by using counter
monitor
Ver. 1.0 Slide 1 of 11
2. Code Optimization and Performance Tuning Using Intel VTune
Installing Windows XP Professional Using Attended Installation
Activity: Using Call Graph – 2
Problem Statement:
John has developed a code in Java, which involves the use of
two-dimensional matrices. However, on execution, the
application performs very slowly. Therefore, John decides to
view the functional flow of the application and find the details of
the functions that have large self time. Therefore, John decides
to analyze the performance of the application using call graph
of VTune Performance Analyzer. Help John accomplish his
task.
Ver. 1.0 Slide 2 of 11
3. Code Optimization and Performance Tuning Using Intel VTune
Installing Windows XP Professional Using Attended Installation
Activity: Using Call Graph – 2 (Contd.)
Solution
To analyze the performance of the application using call graph,
you need to perform the following tasks:
1. Configure call graphs using the Call Graph Configuration wizard.
2. Analyze the functional flow of the application.
3. Analyze the time taken by each function to execute.
Ver. 1.0 Slide 3 of 11
4. Code Optimization and Performance Tuning Using Intel VTune
Installing Windows XP Professional Using Attended Installation
Using Counter Monitor
Counter monitor:
Enables you to identify system-level issues in an application.
Monitors and graphically displays performance counter data.
Helps you understand the cause-and-effect relationship
between an application and the system on which the
application is running.
Ver. 1.0 Slide 4 of 11
5. Code Optimization and Performance Tuning Using Intel VTune
Installing Windows XP Professional Using Attended Installation
Activity: Collecting Performance Counter Data – 1
Problem Statement:
Jim has developed a code to generate a list of random
numbers. Once the numbers are generated, the user can also
implement a delete operation on the list. However, on
executing the application, he finds that the application is
performing slowly. Jim has analyzed the performance of the
application using sampling and call graph data collector of
VTune Performance Analyzer. Now Jim decides to use counter
monitor of VTune Performance Analyzer to analyze the
cause-and-effect relationship between an application and the
system on which the application is running. Therefore, Jim
decides to analyze the performance of the application using the
counter monitor feature of VTune Performance Analyzer. Help
Jim to analyze the performance of the application using VTune
Performance Analyzer?
Ver. 1.0 Slide 5 of 11
6. Code Optimization and Performance Tuning Using Intel VTune
Installing Windows XP Professional Using Attended Installation
Activity: Collecting Performance Counter Data – 1 (Contd.)
Solution
To analyze the performance of the application using counter
monitor, you need to perform the following tasks:
1. Configure counter monitor using the Counter Monitor
Configuration wizard.
2. Analyze the results of counter monitor.
Ver. 1.0 Slide 6 of 11
7. Code Optimization and Performance Tuning Using Intel VTune
Installing Windows XP Professional Using Attended Installation
Activity: Collecting Performance Counter Data – 1 (Contd.)
Solution
After collecting data, VTune Performance Analyzer displays the
collected counter data in the following three views:
• Runtime Data View: Displays the chart of the performance
counters selected at run time as the activity progresses and
counter data is collected.
• Logged Data View: Displays the performance counter data
selected for logging in the Logged Data view, after the activity
ends.
• Summary Data View: Displays a statistical view of the counter
data.
Ver. 1.0 Slide 7 of 11
8. Code Optimization and Performance Tuning Using Intel VTune
Installing Windows XP Professional Using Attended Installation
Activity: Collecting Performance Counter Data – 2
Problem Statement:
Jim has developed an application in Java that involves the use
of arrays. He decides to analyze the performance of his
application using the counter monitor feature of VTune. He
wants to view the processor utilization and the amount of
context switching involved in his application. After analyzing
the performance of his application, he wishes to optimize his
application accordingly. Help Jim to analyze the performance
of his application.
Ver. 1.0 Slide 8 of 11
9. Code Optimization and Performance Tuning Using Intel VTune
Installing Windows XP Professional Using Attended Installation
Activity: Collecting Performance Counter Data – 2 (Contd.)
Solution
To analyze the performance of the application using counter
monitor, Jim needs to perform the following tasks:
1. Configure counter monitor.
2. Analyze the results of counter monitor.
Ver. 1.0 Slide 9 of 11
10. Code Optimization and Performance Tuning Using Intel VTune
Installing Windows XP Professional Using Attended Installation
Activity: Collecting Performance Counter Data – 2 (Contd.)
Solution
You cannot directly configure counter monitor wizard for java
application.
To collect counter monitor data for java application, you can
first create an activity using the sampling wizard and then
modify the activity by adding counter monitor from the available
data collectors list.
Ver. 1.0 Slide 10 of 11
11. Code Optimization and Performance Tuning Using Intel VTune
Installing Windows XP Professional Using Attended Installation
Summary
In this session, you learnt that:
The counter monitor collector monitors and graphically displays
performance counter data.
The performance counter is a feature that measures and
gathers the performance-related data that represents the state
of a system.
Ver. 1.0 Slide 11 of 11
Editor's Notes
Share the objectives with the students.
To demonstrate this activity, you can use the data files provided at the following locations: TIRM Datafiles for Faculty Chapter04 Activity05 JavaApplication.zip JavaApplication.zip file contains the optimized and the unoptimized codes. The faculty should first show the demonstration of the unoptimized code. After analyzing the call graph results, the faculty should again run the activity using the optimized code. This would enable the students comparing the results between the optimized and the unoptimized code.
To demonstrate this activity, you can use the data files provided at the following locations: TIRM Datafiles for Faculty Chapter04 Activity05 JavaApplication.zip JavaApplication.zip file contains the optimized and the unoptimized codes. The faculty should first show the demonstration of the unoptimized code. After analyzing the call graph results, the faculty should again run the activity using the optimized code. This would enable the students comparing the results between the optimized and the unoptimized code.
Discuss with the students about various counter data. Discuss about various memory and processor bottlenecks. The Counter Monitor feature of VTune Performance Analyzer provides system-level performance information, such as resource consumption, during the execution of an application. The counter monitor data collector of VTune Performance Analyzer collects data for specific performance counter. Ask the students to use VTune Help to explore about how to select a specific counter. The various features of counter monitor collector that you can use are Trigger mechanism and Counter Monitor views. The Trigger mechanism creates trigger to monitor hardware and software counters at predetermined intervals. The various counter monitor views such as runtime view, logged data view, and summary data view helps you to analyze the data collected by the counter monitor. Ask the students to explore the VTune Help to explore about the various views of counter monitor data collector.
To demonstrate this activity, you can use the data files provided at the following locations: TIRM Datafiles for Faculty Chapter04 Activity06 Create list.zip Create list.zip file contains the optimized and the unoptimized codes. The faculty should first show the demonstration of the unoptimized code. After analyzing the counter monitor results, the faculty should again run the activity using the optimized code. This would enable the students comparing the results between the optimized and the unoptimized code. In the unoptimized code given for the preceding activity, delete operations are being implemented from the first position of the array list. Deleting an element from the first position of the array requires shifting of all the succeeding elements in the list one position back. Since the list is huge, multiple delete operations from the first position in the list becomes very time consuming. If your application requires you to implement multiple delete operation from the first position of a huge list, it would be better to use a linked list instead of array. The faculty should run the optimized code, which implements a singly linked-list instead of an array.
To demonstrate this activity, you can use the data files provided at the following locations: TIRM Datafiles for Faculty Chapter04 Activity05 JavaApplication.zip JavaApplication.zip file contains the optimized and the unoptimized codes. The faculty should first show the demonstration of the unoptimized code. After analyzing the call graph results, the faculty should again run the activity using the optimized code. This would enable the students comparing the results between the optimized and the unoptimized code.
To demonstrate this activity, you can use the data files provided at the following locations: TIRM Datafiles for Faculty Chapter04 Activity05 JavaApplication.zip JavaApplication.zip file contains the optimized and the unoptimized codes. The faculty should first show the demonstration of the unoptimized code. After analyzing the call graph results, the faculty should again run the activity using the optimized code. This would enable the students comparing the results between the optimized and the unoptimized code.
To demonstrate this activity, you can use the data files provided at the following locations: TIRM Datafiles for Faculty Chapter04 Activity07 Matrix Class.zip Matrix Class.zip file contains the optimized and the unoptimized codes. The faculty should first show the demonstration of the unoptimized code. After analyzing the counter monitor results, the faculty should again run the activity using the optimized code. This would enable the students comparing the results between the optimized and the unoptimized code. In Intel Vtune, you cannot directly analyze the counter monitor results of a Java application. Tell the students if you want to analyze a Java application using the counter monitor feature of Vtune, you can first use the sampling wizard in which you can mention the .class file. You can then modify the activity by using the Advanced Activity Configuration dialog box from which you can select counter monitor from the collectors list.