rem ********************************************************************
rem * Filename          : %M% - Version %I%
rem * Author            : Virag S.
rem *                     John Strother, Craig Shallahamer, Mike Jondrow
rem * Original          : 17-APR-95
rem * Last Update       : %H% - %T%
rem * Description       : Load session wait information
rem * Usage             : start swsr.sql <run id>
rem ********************************************************************

def runid=&&1

def aps_prog    = 'swsr.sql'
def aps_title   = 'Session Wait Summary Report'
start apstitle

break on runid

col rid   heading "Run ID"     format 99999
col ss    heading "Session ID" format 999
col event heading "Event"      format A30
col cnt   heading "Hits"       format 9,999,999

select runid rid,
       sid ss,
       event,
       count(*) cnt
from aps_session_wait_log
where runid = &runid
group by runid,sid,event
/

col rid   heading "Run ID"              format 999
col ss    heading "Session ID"          format 999
col event heading "Event"               format A30
col cnt   heading "Hits"                format 9,999,999
col tt    heading "Timespan (secs)"     format 999

select runid rid,
       sid ss,
       count(*) cnt,
       (max(cr_Date)-min(cr_date))*24*3600 tt
from aps_session_wait_log
where runid = &runid
group by runid,sid;

