Presentation is loading. Please wait.

Presentation is loading. Please wait.

Once you click on this slide to manually advance the presentation it will automatically transition into components of the brand manifesto. Upon reaching.

Similar presentations


Presentation on theme: "Once you click on this slide to manually advance the presentation it will automatically transition into components of the brand manifesto. Upon reaching."— Presentation transcript:

1 Once you click on this slide to manually advance the presentation it will automatically transition into components of the brand manifesto. Upon reaching the logo you will again need to advance slides manually.

2 William B. Heys Senior Consultant
Improving Application Performance with the PowerBuilder Trace Engine and Profiler Application William B. Heys Senior Consultant

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

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

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

6 Copyright 1999, Whittman-Hart, Inc. all rights reserved
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

7 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

8 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

9 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 Trace File Copyright 1999, Whittman-Hart, Inc. all rights reserved

10 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

11 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

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

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

14 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

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

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

17 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

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

19 Copyright 1999, Whittman-Hart, Inc. all rights reserved
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

20 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

21 Copyright 1999, Whittman-Hart, Inc. all rights reserved
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

22 Copyright 1999, Whittman-Hart, Inc. all rights reserved
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

23 Copyright 1999, Whittman-Hart, Inc. all rights reserved
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

24 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

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

26 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

27 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

28 Copyright 1999, Whittman-Hart, Inc. all rights reserved
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

29 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

30 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

31 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

32 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

33 Copyright 1999, Whittman-Hart, Inc. all rights reserved
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

34 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

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

36 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

37 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

38 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

39 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

40 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

41 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

42 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

43 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

44 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

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

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

47 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

48 Copyright 1999, Whittman-Hart, Inc. all rights reserved
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

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

50 Application Profiler - Routines
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

51 Call Graph Model - Timing Information
Hits - number of times a routine was called Self time - time spent in the routine, excluding time spent calling other routines AbsoluteSelfTime - total for all executions MinSelfTime - shortest single execution MaxSelfTime - longest single execution PercentSelfTime - percentage AbsoluteSelfTime to total trace time for the run Copyright 1999, Whittman-Hart, Inc. all rights reserved

52 Call Graph Model - Timing Information
Total time (self + called) - time spent in the routine including time spent calling other routines AbsoluteTotalTime - total time for all executions MinTotalTime - shortest single execution MaxTotalTime - longest single execution PercentTotalTime - percentage AbsoluteTotalTime to total trace time for the run Copyright 1999, Whittman-Hart, Inc. all rights reserved

53 Copyright 1999, Whittman-Hart, Inc. all rights reserved
Profiler Class View Each system or user-defined class having any routines executed is listed Displays # of hits and timing information for all routines called in a class Embedded SQL appears in a psuedo class called ESQL Can ‘drill-down’ to see data for each routine and subroutines it calls Three tabs: numbers, graph and source code Copyright 1999, Whittman-Hart, Inc. all rights reserved

54 Copyright 1999, Whittman-Hart, Inc. all rights reserved
Profiler Class View Copyright 1999, Whittman-Hart, Inc. all rights reserved

55 Copyright 1999, Whittman-Hart, Inc. all rights reserved
Profiler Routine View Shows calls, hits, and timing information for all routines (functions and events) executed Shows where each routine is called from and the calls it makes to other routines Two tabs: detail and source code view Routine detail shows minimum and maximum times when a routine is called more than once Copyright 1999, Whittman-Hart, Inc. all rights reserved

56 Copyright 1999, Whittman-Hart, Inc. all rights reserved
Profiler Routine View Copyright 1999, Whittman-Hart, Inc. all rights reserved

57 Copyright 1999, Whittman-Hart, Inc. all rights reserved
Profiler Trace View Shows the elapsed time taken by each activity in chronological order (execution path) Expandable/collapsible tree view shows details for each routine Line by line detail of user-written routines is available (if line information was captured during profiling) Source code is available for each line Similar to pbdebug output Copyright 1999, Whittman-Hart, Inc. all rights reserved

58 Copyright 1999, Whittman-Hart, Inc. all rights reserved
ProfilerTrace View Copyright 1999, Whittman-Hart, Inc. all rights reserved

59 Interpreting Trace Results
Look for classes and routines consuming a significant percentage of overall execution time Look for routines called many times Particularly routines consuming a large percentage of overall time An small improvement here may make a big change in overall time Copyright 1999, Whittman-Hart, Inc. all rights reserved

60 Interpreting Trace Results
Look for routines that are called once or twice but use a large percentage of time There may be a way to improve the routine Look at database access Tuning the SQL can make a big difference Copyright 1999, Whittman-Hart, Inc. all rights reserved

61 Copyright 1999, Whittman-Hart, Inc. all rights reserved
Demo Copyright 1999, Whittman-Hart, Inc. all rights reserved

62 Copyright 1999, Whittman-Hart, Inc. all rights reserved
About the Speaker CPD Professional Certified PowerBuilder Developer Since 1994 Advanced CSI Certified Sybase Instructor (Tools) Since 1992 Founded Boston PowerBuilder User Group in 1992 Copyright 1999, Whittman-Hart, Inc. all rights reserved

63 Special Edition Using PowerBuilder 6
$49.99 850 pages Copyright 1999, Whittman-Hart, Inc. all rights reserved

64 Special Edition Using PowerBuilder 6
ISBN: x Macmillan (Que) website ( Go to Site Search, Book Information and enter ISBN Amazon.Com ( Search on author: Heys, William SoftPro Bookstore ( Copyright 1999, Whittman-Hart, Inc. all rights reserved

65 Copyright 1999, Whittman-Hart, Inc. all rights reserved
Articles on the Web “Improving Application Performance with the PowerBuilder Trace Engine and Application Profiler” published online in Sybase Powerline magazine “Application Partitioning – Architecting Applications for the Future” published online at PowerCard99, sponsored by Sybase in U.K. Copyright 1999, Whittman-Hart, Inc. all rights reserved

66 Copyright 1999, Whittman-Hart, Inc. all rights reserved
Articles in Power Times “EASy Does IT: Migrating Applications from Distributed PowerBuilder to Enterprise Application Server 3.0” published in PowerTimes, July-August 1999 “A Brighter future for PowerBuilder and Sybase” Guest editorial published in PowerTimes, July-August 1999 “The New Millennium is Bugging Me, PowerBuilder and the Year 2000 issue” published in PowerTimes, January-February 1999 issue. Copyright 1999, Whittman-Hart, Inc. all rights reserved

67 Books and Articles by Bill Heys
Special Edition Using PowerBuilder 5.0. Co-author, published by Que June 1996 “NVOs How and Why” Posted to CompuServe (Go PBForum) NVO Library Section Filename is NVOHOW.Zip August 1995 Copyright 1999, Whittman-Hart, Inc. all rights reserved

68 PowerBuilder Advisor Columns
“How the PowerBuilder 5.0 Foundation Class Libraries Implement a Service-Based Architecture.” November-December 1996 “New Language Features in PowerBuilder 5.0.” September-October 1996 “Managing your PowerBuilder Objects.” May-June 1996 “Encapsulating Your Objects” March-April 1996 “Introduction to Custom Classes” January-February 1996 (Premier Issue) Copyright 1999, Whittman-Hart, Inc. all rights reserved

69 Copyright 1999, Whittman-Hart, Inc. all rights reserved
You can reach me... William B. Heys Senior Consultant +1 (781) direct +1 (617) cell marchFIRST.com attglobal.net marchFIRST, Inc. 128 Corporate Center 70 Blanchard Rd., 2nd Flooor Burlington, MA 01803 +1 (781) tel +1 (781) fax Copyright 1999, Whittman-Hart, Inc. all rights reserved

70 Once you click on this slide to manually advance the presentation it will automatically transition into components of the brand manifesto. Upon reaching the logo you will again need to advance slides manually.


Download ppt "Once you click on this slide to manually advance the presentation it will automatically transition into components of the brand manifesto. Upon reaching."

Similar presentations


Ads by Google