Oracle Enterprise Manager Oracle Trace Developer's Guide
Release 1.4.0
A53697_01

Library

Product

Contents

Index


Prev Next

E
Sample Instrumented Application

This appendix provides access to a sample instrumented application.

The application simulates an automated teller machine (ATM). It is instrumented to gather information about the user interface and response time and patterns of ATM use among users. The purpose of instrumenting was to answer such questions as:

You can refer to this sample for examples of instrumenting details.

Events in the Sample Application

Table E-1 describes the events that are instrumented in the ATM sample application.

Table E-1 Events in the ATM Sample Application
Event   Description   Items for Event   Type of Event  

BALANCES  

Performs an account balance inquiry  

resource_items, cross_fac_1  

Duration  

DEPOSIT  

Records deposit and updates balance  

resource_items, cross_fac_1, amount  

Duration  

WITHDRAWAL  

Verifies amount is available, records withdrawal, and updates balances  

resource_items, cross_fac_1, amount  

Duration  

TRANSFER  

Moves amount from one account to another  

resource_items, cross_fac_1, amount, dest_acct  

Duration  

QUICKWTHDRW  

Verifies there is enough in the account, withdraws $50, and updates the balances  

resource_items, cross_fac_1, amount  

Duration  

OVERDRAFT  

Records error message if there is not enough in the account to cover the withdrawal  

cross_fac_1, acct_num  

Point  

SESSION  

Records duration of ATM session  

resource_items  

Duration  

VALIDOK  

User entered valid account number  

acct_num  

Point  

VALIDERR  

User entered invalid account number  

acct_num  

Point  

Running the ATM Sample Application

To install and run the ATM sample application provided by Oracle Trace, take the following steps:

  1. Define ORACLE_HOME to point to the Oracle home directory (which contains the Oracle Server). For example,
  2.    setenv ORACLE_HOME /oracle/product
    
    
    
  3. Define ORACLE_SID to the SID of the database you will use to store the ATM tables and data. For example,
  4.    setenv ORACLE_SID trace
    
    
    
  5. Locate or create sufficient tablespace for the ATM data you plan to load:
  6. Number of Records   Number of Data Blocks
    (2048 Bytes Each)
     

    100  

    10  

    2,500  

    100  

    10,000  

    400  

  7. Log in as System and create ATM user:
  8.     % sqlplus system\manager
          SQL> create user atm identified by sampleatm
            2> default tablespace is <atm_space> quota
            3> unlimitd on  <atm_space>;   
          SQL> grant create session, create table to atm;
    
    
    
  9. Disconnect, connect as atm, and execute SQL scripts:
  10.    SQL> disconnect
       SQL> connect atm\sampleatm
       SQL> @atmtab
       SQL> @atmdat
       SQL> @atmind
    
    
    

    The atmtab.sql script creates tables. The atmdat.sql script loads data for 10,000 accounts. Use either atmdat100.sql or atmdat2500.sql to load fewer accounts. The atmind.sql script creates indexes.

  11. Compile the sample application using the appropriate commands for your operating system's C compiler. The sample application must be linked against libepc.a and libepcpt.a in $ORACLE_HOME/lib.
  12. The atmoci.c version of the sample application uses the Oracle Call Interface. Refer to the OCI documentation set for information on the Oracle Call Interface.

    The atmpc.pc version of the sample application uses the Pro*C interface. It should be processed by the Pro*C compiler before compiling. Refer to the Pro*C documentation for further information.

  13. To start collections for the ATM example from the Oracle Trace console, you must first copy the ATM product definition file, atm.fdf, from the server machine to the correct directory as follows:
  14.    % cp $ORACLE_HOME/otrace/demo/atm.fdf $ORACLE_HOME/rdbms/demo
    
    
    
  15. Run the sample application. The ATM program looks for the product definition file in the current directory. If the product definition file is not found, you get an error. Copy the atm.fdf file to the current directory.
  16. Optional step: To pass input through a data file rather than entering it interactively, enter:
  17.    % atmoci atm.inp
       input file is atm.inp
    
    
    

    You will not see any output to the terminal when you pass in a data file.

To review the code for the ATM sample application, see the files in the $ORACLE_HOME/otrace/demo directory. You can refer to these files for examples of how to include calls to Oracle Trace routines within your own application.

Note:

For Windows NT systems, refer to the files in the $ORACLE_HOME\otracexx\admin\sample directory.  




Prev

Next
Oracle
Copyright © 1997 Oracle Corporation.
All Rights Reserved.

Library

Product

Contents

Index