Notes
Slide Show
Outline
1
Profiling Java applications using
 Eclipse* Test and Performance Tools Platform
2
Instructors
      • Mikhail Voronin
  • Intel Corporation
      • mikhail.voronin@intel.com


      • Alexander Alexeev
  • Intel Corporation
  • TPTP Committer
      • alexander.n.alexeev@intel.com


3
Agenda
  • Unit 1 – Eclipse* TPTP Overview
  • Unit 2 – Using the TPTP Java Profiler
      • Profiler Architecture
      • Profiling and Logging Perspective
      • Launch and Attach
      • Profiling options and views
      • Demo
      • Profiler Preferences
  • Conclusion, Opens and Limitations
4
Participants
  • Tell me a little about yourselves…


  • From where
  • Company or academic institution
  • Users or Adopters
  • Eclipse* and TPTP experience
  • Java* experience
  • Have you used a Java* profiler before?
  • Tutorial expectations
5
"Unit 1 – Eclipse*"
  • Unit 1 – Eclipse* TPTP Overview
  • Unit 2 – Using the TPTP Java Profiler
      • Profiler Architecture
      • Profiling and Logging Perspective
      • Launch and Attach
      • Profiling options and views
      • Demo
      • Integration with BIRT
      • Profiler Preferences
  • Conclusion, Opens and Limitations
6
 
7
Eclipse* TPTP Overview
  • Composed of 4 sub projects:
    • Platform
    • Test
    • Trace and Profiling
    • Monitoring
  • Principles:
    • Extension of the Eclipse* Value Proposition
    • Vendor Ecosystem
    • Vendor Neutrality
    • Standards-Based Innovation
    • Agile Development
    • Inclusiveness & Diversity
  • TPTP is highly extensible.
8
 
9
Eclipse* TPTP Profiling Tool Overview
  • Broadly useful for performance analysis and for gaining a deeper understanding of a Java* program
  • Consists of the Profiling and Logging Perspective and a number of graphical and tabular views
  • Visualize program execution and threading behavior; Pinpoints operations that taking most resources; Explore patterns of program behavior
  • Enables you to test your application's performance early in the programming development cycle for improvements
  • Option to run application with agent at near full speed (enabled mode) and attach to it to gathering details at certain phase.
  • Assorted filtering functionality which can help to localize problem and reduce overhead for large long run applications


10
Eclipse* TPTP Agent Controller Overview
  • A daemon process that resides on each deployment host and enables client applications to launch host processes and interact with agents that coexist within host processes
  • Contains a server that has the capability to launch and manage local or remote applications from a local TPTP workbench
  • The Java* profiler is a managed agent that can be used to profile local or remote Java* applications from a local TPTP workbench


11
JVMTI-based Java* Profiler vs. JVMPI-based
  •  Java* 5.0 has introduced new standards for profiling
    • Prior to Java* 5.0 (Java* 1.4-) the standards and the interfaces to support profiling (JVMPI) were experimental
      • Java* J2SE 6 eliminated JVMPI interface
    • The new standard (JVMTI) is an innovative solution to profiling and enables you control precisely which parts of an application are profiled
    • Eclipse* TPTP has embraced this innovation and the new Java* profiler is based on this new standard
  • In Eclipse* TPTP old Java* profiler (JVMPI) still exists
    • Only for backward compatibility with Java* 1.4
    • Because of JVMPI/JVMTI interface differences there are some differences in behavior between old and new profiler
    • Old Java* profiler will eventually be removed from Eclipse* TPTP
12
"Unit 1 – Eclipse*"
  • Unit 1 – Eclipse* TPTP Overview
  • Unit 2 – Using the TPTP Java* Profiler
      • Profiler Architecture
      • Profiling and Logging Perspective
      • Launch and Attach
      • Profiling options and views
      • Demo
      • Integration with BIRT
      • Profiler Preferences
  • Conclusion, Opens and Limitations
13
JVMTI-based Java* Profiler
  • A set of libraries that attach to a JVM for recording Java* application's behavior
  • An extensible framework, consisting of a core runtime component (Martini), an agent managed by the Agent Controller (JPIAgent), and a set of data collection libraries built on top of the Martini runtime.
  • Can be used to identify performance details such as classes or methods responsible for execution bottlenecks, analyze application heap to find memory leaks and visualize threading behavior.
  • Output in the form of XML fragments (XML4Profiling)
  • Can be launched from the Eclipse* IDE or as a standalone program using JVM command-line options
  • Applications under test can reside in Eclipse* workspace,  binaries on file system, or hosted in a J2EE application server.
14
JVMTI-based Java* Profiler Architecture
15
Profiling and Logging Perspective
  • Profiling and Logging perspective provides resources for starting a profiling session as well as obtaining comprehensive information on the performance of the monitored application


  • The profiling tool provides information pertaining to
    • Execution analysis
    • Method execution performance
    • Object allocations
    • Thread interactions
16
Profiling and Logging Perspective
  • Combinations of views and editors that are best suited to perform application profiling


  • Profiling Monitor view
    • Administrate profiling resources and manage activities
  • Profiling views
    • Visualize and analyze profiling data
  • Profiling actions
    • Control profiling resources
    • Actions are resource sensitive
    • Choice of action depending on type and status of the object in selection
      • Attach and Detach the agent from process
      • Start and Stop monitoring on an agent
      • Terminate a process


17
 
18
 
19
Launch and Attach
  • Profiling session is started by launching an application or by attaching to a running application
    • Launch : start an application with a profiling agent
    • Attach : attach to an application which is already started and invoked with a profiling agent
  • How? Launch configuration is where you start the session.


20
Launch and Attach - Configuration
  • A place to create, run and manage profiling sessions.


  • Configure the details of a profiling session
    • Target host
    • Application to profile
    • Scope of the profile
    • Profile data destination

  • Select launch configuration type according to the location of the target Java* application:
    • Within Workbench > “Java Application” launch configuration
    • Outside Workbench > “External Java Application” launch configuration

21
Launch and Attach – Configuration Tabs
  • Collect and display detail information about a configuration


  • Tabs for profiling:
    • Monitor tab : defines detail of data collection on a profiling session
    • Destination tab : defines the destination of the profiling data
    • Host tab : for external application configurations only, defines the location of process to be launched or attached
    • Agents tab : for attach configurations only, lists agents available for attach



22
Launch and Attach – Monitor Tab
23
Launch and Attach – Profiling Options
24
Profiling Options – Filter Set
  • Limit the scope of a profiling session


  • Ensure that only relevant details are collected


  • Especially useful when speed and efficiency is critical
    • Excluded classes and methods are not instrumented and execute in full speed

  • Only the first applicable filter is applied. When you are specifying filters, ensure that you declare the most specific filter criteria first


25
Launch and Attach – Execution Analysis Options
26
Execution Time Analysis Options
  • Specifies the type of information to collect during execution time analysis


  • Use the “Show execution statistics” option to identify the most time-consuming methods
    • Low-overhead. Can be used without extensive filtering


  • Use the “Show execution flow graphical details” option to identify the relationships between executing methods (call-tree).
    • High-overhead. Filtering is recommended.
27
Launch and Attach – Memory Analysis Options
28
Memory Analysis Options
  • Specifies the type of information to collect during memory analysis


  • Use the “Track object allocation sites” option to identify the source line where each object is allocated
    • May slightly increase analysis overhead
29
Launch and Attach – Destination Tab
  • Specify the destination of the profile data
    •  Workbench : Visualize and analyze in profiling views (default)
    •  File : export to XML file, available for import.

  • Import profiling file
    •  File >  Import ... > Profiling file
30
Profiling an External Application – Host Tab
31
Attaching to a Running Application – Monitor Tab
32
Profiling Views
  • A collection of views to visualize and analyze profiling data
    • Memory Statistic view (tabular)
    • Execution Statistic view (tabular)
    • Coverage Statistic view (tabular)
    • Method Invocation Detail view (tabular)
    • Execution Flow view and table (graphical + tabular)
    • Method Invocation view and table (graphical + tabular)
    • Execution Call Tree (graphical + tabular)
    • UML2 Trace Interactions view (graphical)
33
Recommendations for effective profiling
  • Using filters to collect only needed data


  • Pause/resume to select activities to profile


  • Attach/Detach to eliminate overhead when we don’t profile



34
A few words on filtering in TPTP
  • Collection Time Filtering
    • Pro: Reduce data volume and instrumentation overhead (critical)
    • Con: Data for excluded classes/method can never be seen
  • Model Import Filtering
    • Pro: Reduce workbench memory footprint (critical on 32bit OSes)
    • Con: Can only see data that is in the model
  • View Level Filtering
    • Pro: Remove items from being visualized in the workbench
    • Con: Does not reduce data volume or model footprint
35
Access to Attach/Detach and Pause/Resume
36
Java* Profiling - Demo
  • Profiling a local Java* application
    • Execution Time Analysis
    • Memory Analysis
    • Thread Analysis


  • Profiling an External Java* Application


  • Profiling an Eclipse* Plugin (RCP Application)


  • Profiling a J2EE (Server) Application


37
Java* Profiling - Preference
  • Dialog to set user preference
    • Window > Preferences...

  • Set default profiling values


  • Add host


  • Configure view preferences


38
Java* Profiling - Attach
  • Start application under profile in standalone mode
  • Invoke the Java* Profiling Agent, a library that attaches to a Java* virtual machine (JVM) to capture and record the behavior of the Java* application
  • Use the -agentlib JVM option to invoke the Java* Profiling Agent:
    • -agentlib:JPIBootLoader=JPIAgent:server=enabled;{profiler}
  • Communication with the agent invoked is done using a client workbench by means of the Agent Controller on the host machine.
  • Attach to the agent : Profile Configuration... > Attach to Agent
39
"Unit 1 – Eclipse*"
  • Unit 1 – Eclipse* TPTP Overview
  • Unit 2 – Using the TPTP Java* Profiler
      • Profiler Architecture
      • Profiling and Logging Perspective
      • Launch and Attach
      • Profiling options and views
      • Demo
      • Integration with BIRT
      • Profiler Preferences
  • Conclusion, Opens and Limitations
40
TPTP Profiler Future
  • Updates for Ganymede
  • Improve overall usability via assorted fixes
    • Using feedback from users
  • Reduce usability diffs between JVMPI and JVMTI…
    • e.g., SSL for secure communications
    • e.g., Reduce overuse of dynamic attach/detach
  • Enhancements
    • e.g., Better multithread analysis
      • Improved visualization
      • Contended lock analysis
      • Track more thread states (e.g., join points)
    • e.g., Efficient binary transfer format
    • e.g., Better Java* 6 support

  • Long-term
  • JVM Heap analysis and trends
  • Object reference analysis
  • Graphic representation of profiling data and JVM telemetry
41
Resources
42
"Q & A"
  • Q & A
43
TPTP @ EclipseCon2008

  • Short Tutorials (2 hours)
    • Profiling Java* applications using Eclipse* TPTP
    • Alexander Alexeev, Mikhail Voronin, Monday, 08:00, Great America Meeting Room 1
  • Long Talk (50 mins)
    • A Harmonious Combo : Experiences Profiling Apache* Harmony with Eclipse* TPTP
    • Chris Elford, Sergey Kuksenko, Thursday, 14:30, Grand Ballroom C
    • Functional Testing with the Eclipse* TPTP Project
    • Eric Long, Tuesday, 14:30, Room 206
    • Extending TPTP for database unit testing
    • Wei Liu, Der Ping Chou, Hong-Lee Yu, Don Clare, Thursday, 13:30, Theatre


  • Short Talk (10 mins)
    • Extending TPTP for TTCN-3.
    • Paul Slauenwhite, Wednesday, 15:30, Room 209/210



44
 
45
"Legal Notices:"
  • Legal Notices:


    • Other company, product, or service names may be trademarks or service marks of others.