HP 3000 Manuals

Getting Started Tutorial [ HP SPT/XL User's Manual: Analysis Software ] MPE/iX 5.0 Documentation


HP SPT/XL User's Manual: Analysis Software

Getting Started Tutorial 

This tutorial uses sample HP SPT/XL logfiles from the tape that came with
this manual.  You can follow the instructions marked with a > to look at
HP SPT/XL online, or if you prefer, you can just read through it.

If you wish to follow this tutorial by running HP SPT/XL and entering the
commands, you must be sure the demonstration logfiles are installed on
your system.  You may put the logfiles in any group to which you have
read-and-write access, but the best place to put them is either in the
group where you will log on when you follow along with the tutorial.  To
put the files on your system, log on to the group in which you want to
place the logfiles and issue these commands:

:FILE T;DEV=TAPE

:RESTORE *T;@.@.@;LOCAL

This will place all the files necessary for the tutorial in your logon
group.


NOTE These logfiles are also referred to in the program-tuning example in chapter 4 which includes a more detailed analysis of the data including checking for consistency of transactions and identifying causes of wait states.
Overview of the Example Application The application used for this tutorial performs a simple order- entry function for a fictitious wine store. It is written in PASCAL and uses a single TurboIMAGE database called HPWINE. The structure of the database is shown in the following diagram.
[]
Figure 3-1. Database Layout The Order Entry program is composed of three logical types of transactions that are executed during the entry of an order: * START_ORDER * PROCESS_ORDER_LINE * COMPLETE_ORDER START_ORDER and COMPLETE_ORDER are executed once per order and PROCESS_ORDER_LINE is executed once per order line. The three transactions are described in more detail below. The START_ORDER transaction displays a VPLUS form (also called START_ORDER) and reads the customer account number. A database inquiry against the CUSTOMERS data set of the HPWINE database is performed to validate the customer account number and retrieve customer details such as name, address, and credit information. The START_ORDER transaction also accesses the CONTROL_INFO data set to generate the next sequential order number. The PROCESS_ORDER_LINE transaction displays a VPLUS form (called ORDER_LINE) and reads the required product code (PRODUCT-NO). A database inquiry against the PRODUCTS data set of the HPWINE database is performed to validate the product number and retrieve product description information. The required vintage (VINTAGE) and quantity are also input by this transaction which searches the STOCKS data set based on PRODUCT-NO and matching on VINTAGE. Stock information is updated for each order line. On completion of each order line, a record is written to the ORDER-LINES data set of HPWINE. A record is also written to a temporary MPE file (SCRATCH) that is summarized during the COMPLETE_ORDER transaction. PROCESS_ORDER_LINE is executed iteratively until the order is complete. The COMPLETE_ORDER transaction does not employ any VPLUS forms, but updates details of a customer's balance in the CUSTOMERS data set of the HPWINE database. Some statistical analysis of the complete order is also performed. Once this transaction has been executed, control is transferred to START_ORDER and the whole sequence executes again. For this tutorial, data was collected on the Order Entry application program executing as a single process in a test environment. The data is based on the input and processing of 5 orders, each containing 50 order lines. The first data collected is recorded in the logfile SPTLOG1. Profiling the Entire Program To get the big picture of how this program acts, first we must look at the Order Entry program as a whole. This will tell us whether it is system-code or user-code intensive, and whether its performance is limited by CPU, memory, disk I/O, or contention for software locks. To run the HP SPT/XL analyzer, do the following: > Type RUN SPT.PUB.SYS at the MPE (:) prompt. > Select the Analyze key on the Main Menu. > Enter the logfile name SPTLOG1 at the prompt. Respond YES or press ENTER at the prompt asking if this is the correct logfile. HP SPT/XL reads the logfile and displays the top ten intrinsics found during monitoring on the Logfile Summary Information screen.
NOTE If the first display you see is the Transaction List screen, this indicates that the logfile has been processed previously. If you wish to start from the beginning of this tutorial, cycle through the function keys using the Next Key Set key and select Redefine Trans. After the logfile is scanned, the Logfile Summary Information screen will be displayed.
[]
Figure 3-2. Logfile Summary Information The Logfile Summary Information screen shown in figure 3-2 presents an initial summary of the data in the logfile. It shows the overall processing time for data collection, the relative percentage of time spent in application code and in system code, and the top 10 system intrinsics in which the monitored application spent its processing time. Even from this introductory display, it is clear that the Order Entry program spends most of its processing time within system intrinsics. HP SPT/XL asks if we want to divide the program into discrete transactions. At present we simply require a more detailed big picture profile of the whole application. By responding NO, we tell HP SPT/XL to regard the entire program as a single transaction and a second logfile scan takes place. > Respond NO to the define transactions? prompt. The Transaction Intrinsic Profile appears:
[]
Figure 3-3. Transaction Intrinsic Profile This profile shows that the vast majority of Order Entry's processing time was spent in intrinsics associated with TurboIMAGE database processing (particularly DBGET) and with those that constitute VPLUS and the MPE file system. Time spent in the HPSWITCHTOCM intrinsic indicates that the application also relies on some reliance upon user procedures that are implemented in compatibility mode. There is an absence of any repetitious file and database openings or closings that would tend unnecessarily to accumulate significant processing time in intrinsics such as FOPEN/FCLOSE and DBOPEN/DBCLOSE. Similarly, there is no evidence of significant processing time being incurred in those facilities used in migration from MPE-V environments, for example, Extra Data Segment use. The substantial time spent in TurboIMAGE intrinsics such as DBGET may indicate that the data on databases and data sets processed by the application needs to be reviewed. Next do the following: > Cycle the function keys using Next Key Set and select the Summary Info key to display the Transaction Summary Information screen.
[]
Figure 3-4. Transaction Summary Information This display shows that when the overall application is defined as a single transaction, 94.4 percent of its processing time is spent in system code; only 5.6 percent is spent in the application code. You can use the 226.642 seconds of processing time as the basis for comparison when evaluating the effect of optimization efforts. The display shows that 36.0 percent of the program's processing time was spent using CPU and 39.6 percent was spent waiting for disk I/O. Given that the optimal situation for MPE-based applications is to maximize the percentage of processing time spent using CPU, this indicates that there is a substantial margin for improvement in the application. The time spent in TurboIMAGE intrinsics shown in figure 3-3 and the time spent waiting for disk I/O shown in figure 3-4 leads us to want to find out about the databases and data sets processed by the application. Next do the following: > Cycle through the function keys using Next Key Set and select the DB Use key to display the Summary TurboIMAGE Database Information screen. It shows data for the one database accessed by the application. > Select the Detailed DB Use key and respond to the prompt by entering the number 1. The Detailed TurboIMAGE Database Information screen is displayed showing detailed data for the HPWINE database. > Select the Summary DSet Inf key to display the Summary TurboIMAGE Data Set Information screen.
[]
Figure 3-5. Summary TurboIMAGE Data Set Information The Summary TurboIMAGE Data Set Information screen indicates that the STOCKS data set is a prime candidate for further investigation. In summary, the information from the Transaction Intrinsic Profile in figure 3-3 and the Transaction Summary Information screen in figure 3-4 shows that the Order Entry application is spending most of its total processing time in system code. In addition, the Summary TurboIMAGE Data Set Information screen in figure 3-5 indicates a data set for further investigation. From these initial displays it is clear that it would be best to concentrate optimization efforts on the intrinsics rather than on economizing computation within the application code. This is the most common profile for interactive, MPE-based, database-processing programs. To tune this type of program effectively would require reducing the frequency of intrinsic calls or the total intrinsic processing time by improving database processing paths or loading characteristics. Defining Logical Transactions Application programs usually process many types of transactions with different individual performance characteristics. In software tuning, it is crucial to be able to divide a program's overall performance profile into individual logical units of work--transactions--for three reasons: * Logical transactions let you identify the dominant type of transaction in a program to pinpoint where tuning will give the best return for your effort. * Specific transaction performance may not be apparent from looking at a program's overall performance. For example, a program with a system-code-intensive profile could be hiding a computation-intensive transaction. * Logical transactions let you see a performance profile in the same way a user perceives program behavior. Users usually identify the program area by the processing associated with a particular screen, and perceive throughput or consistency problems with it. Isolating user-oriented transactions helps you tune the program to address user needs. In "Profiling the Entire Program" we looked at Order Entry as one entity, as if it were one big transaction. This gave us an overall profile of the program. The next step is to identify which transactions contribute the most to total processing time. They offer the best opportunity to improve overall program processing by tuning the code, and associated files and databases. Looking at Transaction Defaults. The first step in defining transactions is to look at what HP SPT/XL found in Order Entry as possible transaction delimiters. > Select the Redefine Trans key (find this key label by using Next Key Set to cycle through the function keys). > HP SPT/XL scans the logfile looking for intrinsics which potentially could be used to define the start of logical transactions, then displays the Logfile Summary Information screen. Respond YES to the define transactions prompt and the Transaction Defaults screen in figure 3-6 is displayed.
[]
Figure 3-6. Transaction Defaults The Order Entry program includes explicit transaction definitions with calls to the STARTTRAN intrinsic, so this is what is shown on the Transaction Defaults display. However, let's investigate how we might define transactions using TurboIMAGE and VPLUS intrinsic calls instead of the STARTTRAN intrinsic. Redefining Transactions. > From the Transaction Defaults screen, select the Reject List key to display the Intrinsic Categories screen.
[]
Figure 3-7. Intrinsic Categories > For an interactive application such as order entry, one obvious transaction delimiter is a function that performs a terminal read. To define VPLUS terminal reads (VREADFIELDS calls) as a transaction delimiter, enter a 3 and press ENTER on the intrinsic categories screen. The corresponding events are shown in the Transaction Definition screen in figure 3-8.
[]
Figure 3-8. Transaction Definition An important part of defining transactions is to ensure that the definitions used by HP SPT/XL correctly represent the logical units of work that have been processed. The Order Entry program is comprised of three user functions--START_ORDER, PROCESS_ORDER_LINE, and COMPLETE_ORDER--and our test involved the processing of five orders and a total of 250 order lines. A study of the transaction definitions in figure 3-8 reveals that the defaults accurately identified one of the three actual logical transactions. (See the "Overview of the Example Application" section in this chapter for details on the three transactions). The START_ORDER transaction is accurately defined in the defaults (six calls to VREADFIELDS against the START_ORDER form--one per order and one to exit the program). The call to VREADFIELDS against ORDER_LINE does not accurately represent the PROCESS_ORDER_LINE transaction, since figure 3-8 shows that 1255 calls to VREADFIELDS were incurred in 250 PROCESS_ORDER_LINE transactions--one occurrence of this logical transaction incurs five VPLUS terminal reads. Also the COMPLETE_ORDER transaction was not identified, since it is purely involved in database updating and does not perform VPLUS terminal reads. Because the default definitions aren't accurate, we will redefine them. > On the Transaction Definition screen, mark event 2 as defining the start of the START_ORDER transaction because this was correct. > Select the Back to Categrys key to start defining the PROCESS_ORDER_LINE transaction. On the Intrinsics Categories screen, enter the category number 4 for a VPLUS form retrieval (a VGETNEXTFORM call). > On the Transaction Definition screen, enter a 1 to select the intrinsic VGETNEXTFORM call against the ORDER_LINE form. > Select the Back to Categrys key to start defining the COMPLETE_ORDER transaction. On the Intrinsics Categories screen, enter the category number 5 for database accesses. > On the Transaction Definition screen, select the Next Page key and enter 16 to select the DBUPDATE on the CUSTOMERS data set in the HPWINE database to represent the start of the COMPLETE_ORDER transaction. > Select the Back to Categrys key TWICE and then the Finished key, to display the Transaction Definition Review screen. > Select the List OK key to end transaction definition. If you get lost during these steps, you can start over by selecting the Start Over key. Once we've defined transactions to match Order Entry's logical transactions, HP SPT/XL restructures the logfile to encompass all currently-defined transactions. The Transaction List shown in figure 3-9 is displayed.
[]
Figure 3-9. Transaction List Note that an additional transaction--"initial processing"--is included to cover the time between the start of HP SPT/XL data collection and detection of the first transaction beginning. As mentioned previously, the Order Entry program actually has logical transactions defined within the code using calls to the STARTTRAN and ENDTRAN intrinsics. Let's see what the transaction content would have been if it had been based on these definitions. > Cycle through the function keys and select the Redefine Trans key. After the logfile is scanned, the Logfile Summary Information screen is displayed. > Respond YES to the Define Transactions prompt. The transaction defaults based on STARTTRAN calls are displayed. > Select Accept List. After the logfile is scanned, the Transaction List screen shown in figure 3-10 is displayed.
[]
Figure 3-10. Transaction List As you can see, there is little difference between this transaction list and the one derived without the STARTTRAN and ENDTRAN intrinsics. The remainder of this tutorial will be based on the definitions using STARTTRAN as shown in figure 3-9.
NOTE Before selecting events to represent the start of logical unit-of-work transactions, you may need to understand a program's processing logic. HP SPT/XL's STARTTRAN and ENDTRAN intrinsics let you define logical transactions precisely. See Appendix B for more on these intrinsics.
Profiling the Dominant Transaction We continue our example by identifying and looking at Order Entry's dominant transaction--the one that consumed the most processing time. From the Transaction List in figure 3-10 we identify the relative contributions of individual transactions to program processing time. PROCESS_ORDER_LINE occurred 255 times during data collection with an average processing time of 0.814 seconds. It is the dominant transaction. We'll apply our tuning effort to it, since tuning it will give us the greatest return. First we'll look at how this transaction acts, just as we did with the overall program. > Select the Choose Trans key and enter a 3 to mark the PROCESS_ORDER_LINE as the active transaction for further analysis. > Select the Intrinsic Profile key. Use the f1 key until this function key label is displayed. Figure 3-11 shows the Transaction Intrinsic Profile for PROCESS_ORDER_LINE.
[]
Figure 3-11. Transaction Intrinsic Profile This profile of PROCESS_ORDER_LINE is slightly different than the overall program's profile, but it confirms that the majority of this transaction's processing time is spent in TurboIMAGE, VPLUS, and the MPE file system intrinsics. Of this time, 49.1 percent is spent in DBGET. This information suggests that we can achieve maximum overall benefit in either of two ways: * Reduce the frequency of calls to these intrinsics from within PROCESS_ORDER_LINE. * Reduce the intrinsics' individual processing times by optimizing loading characteristics of the files and databases PROCESS_ORDER_LINE accesses. > Select the Summary Info key. Use the f1 key until this function key label is displayed. To further review how this transaction spent its time, we look at its Transaction Summary Information screen as shown in figure 3-12.
[]
Figure 3-12. Transaction Summary Information The display identifies an average profile for the PROCESS_ORDER_LINE transaction, showing that it spends a relatively high percentage of its time--42.9 percent--waiting for disk I/O. Thus far we identified the dominant transaction within the Order Entry application as being one whose processing time is dominated by time spent in TurboIMAGE's intrinsic DBGET in accessing the STOCKS data set of the HPWINE database. We also found that the transaction is not maximizing processing time efficiently because it spends a significant time waiting for completion of disk I/O. > To exit from HP SPT/XL, cycle through the function keys to select Main Menu and then select Exit.


MPE/iX 5.0 Documentation