1 / 70

Improving Application Performance with the PowerBuilder Trace Engine and Profiler Application

Improving Application Performance with the PowerBuilder Trace Engine and Profiler Application. William B. Heys Senior Consultant. Stop me at any time for questions. No Question is too small!. Improving Application Performance. Is your application a dog?. Topics.

therese
Télécharger la présentation

Improving Application Performance with the PowerBuilder Trace Engine and Profiler Application

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Improving Application Performance with thePowerBuilder Trace Engine and Profiler Application William B. Heys Senior Consultant

  2. Stop me at any time for questions No Question is too small! Copyright 1999, Whittman-Hart, Inc. all rights reserved

  3. Improving Application Performance Is your application a dog? Copyright 1999, Whittman-Hart, Inc. all rights reserved

  4. Topics • PowerBuilder Tracing and Profiling Features • Trace Engine • Profile Objects and API • Profiler Application Copyright 1999, Whittman-Hart, Inc. all rights reserved

  5. Tracing and Profiling • Helps identify and correct errors • Helps identify performance bottlenecks • Collects data and traces path through a PowerBuilder application during execution • Tracing is available for both run-time executables and in development environment Copyright 1999, Whittman-Hart, Inc. all rights reserved

  6. PowerBuilder Trace Engine • As the application runs, the PB Virtual Machine captures information about what the application does • What events and functions (routines) are executed (including system functions) • How long routines took to execute • What other routines were called by a routine • The exact order in which routines were executed (including line # information) Copyright 1999, Whittman-Hart, Inc. all rights reserved

  7. PowerBuilder Trace Engine • As each profiling event occurs, an entry is written to the file • Profiling events are not Windows events • Trace file contains a log of timer values at certain activity points • User can control how much detail is logged Copyright 1999, Whittman-Hart, Inc. all rights reserved

  8. Trace File PowerBuilder Trace Engine • Has a default name • Application name • With file extension .PBP • Saved in binary format • Not PBDebug - cannot be opened in a text editor • Saved in the same directory as the PBL (by default) • Not portable across operating systems Copyright 1999, Whittman-Hart, Inc. all rights reserved

  9. PowerBuilder Trace Engine • Profiling adds overhead to the execution of the application • The time taken to generate the profiling information is subtracted from the event time in the file • Relative times should be consistent, overall times will fluctuate Copyright 1999, Whittman-Hart, Inc. all rights reserved

  10. Tracing Distributed Applications • Logging is separate for each session • Can trace individual client sessions or the main session • Can trace multiple sessions at the same using separate trace files Copyright 1999, Whittman-Hart, Inc. all rights reserved

  11. Trace Engine Data Collection Application Trace File Tracing and Profiling Steps • Collect trace data while running the application: Copyright 1999, Whittman-Hart, Inc. all rights reserved

  12. Trace File Display Analysis Tracing and Profiling Steps • Analyze trace file and display results: Copyright 1999, Whittman-Hart, Inc. all rights reserved

  13. Tracing a PowerBuilder Application • In development environment • Enable tracing from System Options dialog box profiling tab • When running a PowerBuilder executable • Use the w_StartTrace window (copy from PROFILE.PBL) • Use PowerScript functions to control tracing Copyright 1999, Whittman-Hart, Inc. all rights reserved

  14. System Options Dialog Box Profiling Tab Copyright 1999, Whittman-Hart, Inc. all rights reserved

  15. System Options Dialog Box Profiling Tab Copyright 1999, Whittman-Hart, Inc. all rights reserved

  16. System Options Dialog Box • Enables tracing when running application from the development environment • Traces the entire application • Stops capturing data when the application stops Copyright 1999, Whittman-Hart, Inc. all rights reserved

  17. Trace Timer Kinds • Clock • Process • Thread • None Copyright 1999, Whittman-Hart, Inc. all rights reserved

  18. Clock Timer • Measures absolute time in microseconds with reference to an external activity such as the machine’s startup time • Clock timer’s resolution is machine dependent • Speed of machine’s CPU may affect timer’s resolution • Resolution may be less than one microsecond - smallest measurable unit of time • Default for Windows 95 and Windows NT • Not available on Unix (always uses thread) Copyright 1999, Whittman-Hart, Inc. all rights reserved

  19. Process or Thread Timer • Measures time in microseconds with reference to when the process or thread being executed started • More accurate measurement of actual time a process or thread takes to execute • Excludes time taken by other running processes or threads • Lower resolution than clock timer • Use thread for Distributed PowerBuilder applications • Not available on Win16 • UNIX always uses thread timer Copyright 1999, Whittman-Hart, Inc. all rights reserved

  20. TraceActivity Types • Start and end of logging • ActBegin! • Routine (Entry/Exit) • ActRoutine! • Routine Line Hits • ActLine! • Embedded SQL Verbs (Begin/End) • ActESQL! • Object Creation and Destruction • ActObjectCreate! and ActObjectDestroy! Copyright 1999, Whittman-Hart, Inc. all rights reserved

  21. TraceActivity Types • User-defined Activities • ActUser! • Records an informational message • System Errors and Warnings • ActError! • Garbage Collection • ActGarbageCollect! Copyright 1999, Whittman-Hart, Inc. all rights reserved

  22. TraceActivity Types • Profile Trace • ActProfile! • Includes routine entry/exit, embedded SQL verbs, object creation/destruction, and garbage collection • Complete Trace • ActTrace! • Traces everything except routine line hits • Note: above are not available in development, only by calling PowerScript function Copyright 1999, Whittman-Hart, Inc. all rights reserved

  23. Using Profiler w_StartTrace dialog • Copy w_StartTrace window from PROFILE.PBL to your own application library (PBL) • Add code to your application to open w_StartTrace • Run your application • Open w_StartTrace to start tracing • View the trace file in application profile Copyright 1999, Whittman-Hart, Inc. all rights reserved

  24. Using Profiler w_StartTrace dialog Copyright 1999, Whittman-Hart, Inc. all rights reserved

  25. Opening and Closing the Trace File • Open a trace file and set timer kind • TraceOpen ( readonly string filename, TimerKind timer ) returns ErrorReturn • Close the trace file • TraceClose() returns ErrorReturn Copyright 1999, Whittman-Hart, Inc. all rights reserved

  26. Enable/Disable TraceActivity Types • Enable or Disable logging for activity types while trace file is open but when logging is inactive • Enable logging for a specified activity type • TraceEnableActivity ( TraceActivity activity ) returns ErrorReturn • Disable logging of a specified activity (when trace file is open but while logging is inactive) • TraceDisableActivity ( TraceActivity activity ) returns ErrorReturn Copyright 1999, Whittman-Hart, Inc. all rights reserved

  27. Start and Stop Trace • Start logging all enabled activities • TraceBegin ( readonly string identifier ) returns ErrorReturn • Identifier (trace block label) is optional • Stop logging all enabled activities • TraceEnd() returns ErrorReturn • Note - only while trace file is open Copyright 1999, Whittman-Hart, Inc. all rights reserved

  28. Trace Errors or User Activities • Log a severity level and error message • TraceError ( long severity, readonly string message ) returns ErrorReturn • Log a reference number and informational message • TraceUser ( long info, readonly string message ) returns ErrorReturn • Note - only while tracing is active Copyright 1999, Whittman-Hart, Inc. all rights reserved

  29. Analyzing Trace Results • You have to interpret the results yourself • Build custom analysis and display applications using new profiling and trace system objects • Read the trace file using various PowerScript functions • These functions return objects or arrays of objects containing information about the execution of the application Copyright 1999, Whittman-Hart, Inc. all rights reserved

  30. Two Analysis Models Are Provided • Profiling Package • Performance Analysis (Call Graph model) • Class or Routine • Trace Tree Package • Step by step flow of application execution • Customized Trace File Analysis • Trace file has raw data in readable form • Uss Performance analysis functions to perform customized analysis Copyright 1999, Whittman-Hart, Inc. all rights reserved

  31. Profiling Package (Call Graph) • Builds a performance analysis or call graph model • Contains all the routines called in the trace file • Generates accumulated time and hits relative to one function calling another Copyright 1999, Whittman-Hart, Inc. all rights reserved

  32. Trace Tree Package • Builds a trace tree model • Maintains the ordering of the trace file • Reflects the execution sequence • Used to build Trace view Copyright 1999, Whittman-Hart, Inc. all rights reserved

  33. Processing the Trace File • PowerBuilder provides • A new Profiler API to process the trace file • New Profiler classes • Raw data is returned as instance variables using interface functions • Available to PowerBuilder developers • Simplifies developing custom analysis tools Copyright 1999, Whittman-Hart, Inc. all rights reserved

  34. Trace tree classes New Profiler Classes Performance analysis modeling and trace file classes Copyright 1999, Whittman-Hart, Inc. all rights reserved

  35. Trace Analysis PowerScript Functions • Set trace file to analyze • SetTraceFileName ( string tracefilename ) returns ErrorReturn • Use with Profiling or TraceTree Objects Copyright 1999, Whittman-Hart, Inc. all rights reserved

  36. Building a Trace Analysis Model • Build a call graph model • BuildModel ( powerobject progressobject, string eventname, long triggerpercent ) returns ErrorReturn • Use with Profiling or TraceTree Object • All arguments are optional • May take a long time • Can track progress of the build by specifying a user-defined event Copyright 1999, Whittman-Hart, Inc. all rights reserved

  37. Profiling PowerScript Functions • Get a list of classes in the model • Classlist ( ref ProfileClass list[] ) returns ErrorReturn • Use with Profiling object • Get a list of routines in a model or class • RoutineList ( ref profileroutine list[ ] ) returns ErrorReturn • Use with Profiling and ProfileClass objects Copyright 1999, Whittman-Hart, Inc. all rights reserved

  38. Profiling PowerScript Functions • Get routine root node for model • SystemRoutine ( ref ProfileRoutine routine) returns ErrorReturn • Use with Profiling Object • Get list of routines calling the specified routine • IncomingCallList ( ref ProfileCall list[], boolean aggregateduplicateroutinecalls ) returns ErrorReturn • Use with ProfileRoutine Object Copyright 1999, Whittman-Hart, Inc. all rights reserved

  39. Profiling PowerScript Functions • Get list of routines called by the specified routine • OutgoingCallList ( ref profilecall list[], boolean aggregateduplicateroutinecalls ) returns ErrorReturn • Use with ProfileRoutine and ProfileLine Object Copyright 1999, Whittman-Hart, Inc. all rights reserved

  40. Profiling PowerScript Functions • Get list of lines in routine • LineList ( ref profileline list[ ] ) returns ErrorReturn • Use with ProfileRoutine Object • Line number sequence Copyright 1999, Whittman-Hart, Inc. all rights reserved

  41. Trace Tree PowerScript Functions • Get a list of top-level entries in the trace tree model • EntryList ( ref tracetreenode list[ ] ) returns ErrorReturn • Use With TraceTree object Copyright 1999, Whittman-Hart, Inc. all rights reserved

  42. Trace Tree PowerScript Functions • Get a list of children of the routine or object • GetChildrenList ( ref tracetreenode list[ ] ) returns ErrorReturn • Use with TraceTreeRoutine, TraceTreeObject and TraceTreeGarbageCollect objects Copyright 1999, Whittman-Hart, Inc. all rights reserved

  43. Trace Analysis PowerScript Functions • Destroy the current performance analysis model • DestroyModel() returns ErrorReturn • Use with Profiling or TraceTree objects • Cleans up all objects associated with the model Copyright 1999, Whittman-Hart, Inc. all rights reserved

  44. Trace File Reading the Trace File • Open the trace file • Open ( string filename ) • Use with TraceFile object • Return next activity in trace file • NextActivity ( ) returns TraceActivityNode • Use with TraceFile object • Information about category of activity • Timer value when activity occurred • Activity type Copyright 1999, Whittman-Hart, Inc. all rights reserved

  45. Trace File Reading the Trace File • Reset next activity to beginning of file • Reset() returns ErrorReturn • Use with TraceFile object • Close Trace file • Close() • Use with TraceFile object Copyright 1999, Whittman-Hart, Inc. all rights reserved

  46. Analyzing Trace results • Use the application profiler tool provided as a companion product with the enterprise edition of PowerBuilder (PROFILE.PBL) • Written in PowerBuilder • Source code is provided Copyright 1999, Whittman-Hart, Inc. all rights reserved

  47. Application Profiler • Three views extracted from a call graph model: • Class view • Routine view • Trace view • Numeric views can generally be sorted by by clicking on a column header • Views can be printed Copyright 1999, Whittman-Hart, Inc. all rights reserved

  48. Application Profiler Copyright 1999, Whittman-Hart, Inc. all rights reserved

  49. Application Profiler - Routines • Routine • Events and functions are considered the same • Different icons displayed for functions and events • Routine Aggregation • Option to aggregate statistics when a routine is called from two or more different places in a script • With aggregation, each routine is listed only once within a script • Without aggregation, a routine may be listed multiple times for a script Copyright 1999, Whittman-Hart, Inc. all rights reserved

More Related