.ad 8
.bm 8
.fm 4
.bt $Copyright (c) 1995-2004 SAP AG$$Page %$
.tm 12
.hm 6
.hs 3
.tt 1 $SQL$Project Distributed Database System$vni25c$
.tt 2 $$$
.tt 3 $$$1995-08-10$
***********************************************************
.nf

.nf


    ========== licence begin  GPL
    Copyright (c) 1995-2004 SAP AG

    This program is free software; you can redistribute it and/or
    modify it under the terms of the GNU General Public License
    as published by the Free Software Foundation; either version 2
    of the License, or (at your option) any later version.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with this program; if not, write to the Free Software
    Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
    ========== licence end

.fo


.fo
.nf
.sp
Module  :
=========
.sp
Purpose : x_wiztrc
.CM *-END-* purpose -------------------------------------
.sp
.cp 3
Define  :

.CM *-END-* define --------------------------------------
.sp;.cp 3
Use     :

.CM *-END-* use -----------------------------------------
.sp;.cp 3
Synonym :

.CM *-END-* synonym -------------------------------------
.sp;.cp 3
Author  : 
.sp
.cp 3
Created : 1995-08-10
.sp
.cp 3
\Version : 1995-08-10
.sp
.cp 3
\Release :      Date :
.sp
***********************************************************
.sp
.cp 10
.fo
.oc _/1
Specification:

.CM *-END-* specification -------------------------------
.sp 2
***********************************************************
.sp
.cp 10
.fo
.oc _/1
Description:

.CM *-END-* description ---------------------------------
.sp 2
***********************************************************
.sp
.cp 10
.nf
.oc _/1
Structure:

.CM *-END-* structure -----------------------------------
.sp 2
**********************************************************
.sp
.cp 10
.nf
.oc _/1
.CM -lll-
Code    :
/*PRETTY*/

#include <time.h> 

typedef enum { Time, Date, Double , Float , Long , Int , String } DType ;

typedef enum { e_time, 
/* Caches */
	e_datacache_acc , e_cacache_acc , e_cocache_acc , 
	e_datacache_hit , e_cacache_hit , e_cocache_hit , 
/* Commands */
	e_sql_commands , 
	e_prepares , e_executes , e_commits , 
	e_rollbacks, 
/* Accesses */
	e_sel_acc , e_ins_acc, e_upd_acc , 
	e_del_acc , e_key_acc , e_key_range_acc , e_index_acc , 
	e_index_range_acc , e_iso_index_acc , e_iso_index_range_acc ,
	e_iso_index_scan_acc , e_table_scan_acc , 
/* Read */
	e_sel_read , e_upd_read , 
	e_del_read , e_key_read , e_key_range_read , e_index_read , 
	e_index_range_read , e_iso_index_read , e_iso_index_range_read ,
	e_iso_index_scan_read , e_table_scan_read , 
/* Qual */
	e_sel_qual , e_ins_qual, e_upd_qual , 
	e_del_qual , e_key_qual , e_key_range_qual , e_index_qual , 
	e_index_range_qual , e_iso_index_qual , e_iso_index_range_qual ,
	e_iso_index_scan_qual , e_table_scan_qual , 
/* Stategien */
	e_sel_hit , e_upd_hit ,
	e_del_hit , e_key_hit , e_key_range_hit , e_index_hit , 
	e_index_range_hit , e_iso_index_hit , e_iso_index_range_hit ,
	e_iso_index_scan_hit , e_table_scan_hit , 
/* Locks */
	e_lock_colls ,
	e_lock_row_entries , e_lock_table_entries , e_kb_calls , 
/* Log */
	e_log_reads , 
	e_log_writes , e_log_queue_inserts, e_group_commits, 
        e_log_queue_overfl, 
/* Misc */
	e_phys_reads , 
        e_phys_writes, e_temp_page_reads, e_temp_page_writes, 
	e_temp_page_vreads, e_temp_page_vwrites,e_write_trans ,
/* x_cons Tasks (User)*/
	e_wait_cnt_user , e_vwait_time_user , e_susp_cnt_user , 
	e_susp_time_user , e_rcvrpl_time_user , e_rcvrpl_long_user ,
	e_dev_io_cnt_user, e_dev_io_time_user , 
	e_self_io_cnt_user, e_self_io_time_user ,
	e_cache_swaps ,
/* x_cons Tasks (Server) */
	e_dev_io_cnt_serv, e_dev_pg_write_cnt_serv , e_dev_io_time_serv , 
	e_self_io_cnt_serv, e_self_pg_write_cnt_serv , e_self_io_time_serv ,
/* x_cons Tasks (Logwriter1) */
	e_dev_io_write_cnt_log1, e_dev_pg_write_cnt_log1 , e_dev_io_time_log1 , 
	e_self_io_write_cnt_log1, e_self_pg_write_cnt_log1 , 
	e_self_io_time_log1 ,
/* x_cons Regions Count */
	e_convert_reg_get, e_fbm_reg_get, e_data_reg_get, 
	e_lock_reg_get, e_log_reg_get, e_logwrite_reg_get, 
        e_permfdir_reg_get, e_tempfdir_reg_get, e_trace_reg_get ,
	e_datan_reg_get , e_tree_reg_get, e_splittn_reg_get, 
	e_transn_reg_get, e_tabn_reg_get, e_rown_reg_get ,
/* x_cons Regions Colls */
	e_convert_reg_col, e_fbm_reg_col, e_data_reg_col, 
	e_lock_reg_col, e_log_reg_col, e_logwrite_reg_col, 
        e_permfdir_reg_col, e_tempfdir_reg_col, e_trace_reg_col ,
	e_datan_reg_col , e_tree_reg_col, e_splittn_reg_col, 
	e_transn_reg_col, e_tabn_reg_col, e_rown_reg_col ,
/* x_cons All */
	e_total_regcoll_rate , e_total_disp_calls , e_total_commands ,
	e_total_prio , e_total_prio_fom_oth , e_total_prio_com_queue ,
	e_total_prio_rav_queue , e_total_prio_commit , e_total_reg_access ,
        e_begexcl_tas_coll , e_total_reg_collision ,
        e_endexcl_tas_coll , e_total_reg_wait  ,
	e_total_state_vwait , e_total_state_vsuspend ,
	e_total_state_vsleep 
	} Denum ;

#define INDEX_SZ 30 

int	Index [INDEX_SZ] ;

int     OverviewIndex [INDEX_SZ] = { e_time ,
	    e_datacache_hit, e_cacache_hit, e_executes, 
	    e_write_trans, e_phys_reads, 
 	    e_phys_writes, e_log_writes, /* e_lock_colls, */ 
	    e_wait_cnt_user , e_vwait_time_user , 
	    e_susp_cnt_user , e_susp_time_user ,
	    e_rcvrpl_time_user , e_rcvrpl_long_user ,
	    e_total_regcoll_rate ,
	    -1 } ;

int     R3OverviewIndex [INDEX_SZ] = { e_time ,
	    e_datacache_hit, e_cacache_hit, e_executes, 
	    e_write_trans, e_phys_reads, 
 	    e_phys_writes, e_cache_swaps , e_log_writes, /* e_lock_colls, */ 
	    e_wait_cnt_user , e_vwait_time_user , 
	    e_susp_cnt_user , e_susp_time_user ,
	    e_rcvrpl_time_user , e_rcvrpl_long_user ,
	    e_total_regcoll_rate ,
	    -1 } ;

int	LogIndex [INDEX_SZ] = { e_time ,
	    e_log_queue_inserts, e_log_queue_overfl, 
	    e_group_commits ,
	    e_log_writes , /* e_log_pg_writes , */ e_log_reads , 
            e_self_io_write_cnt_log1, e_self_pg_write_cnt_log1 , 
	    e_self_io_time_log1 ,
  	    e_dev_io_write_cnt_log1, e_dev_pg_write_cnt_log1 , 
	    e_dev_io_time_log1 ,
	    -1 } ;

int	CommandIndex [INDEX_SZ] = { e_time ,
	    e_sel_acc , e_sel_qual , e_sel_hit ,
	    e_ins_acc , e_ins_qual ,
	    e_upd_acc , e_upd_qual , e_upd_hit ,
	    e_del_acc , e_del_qual , e_del_hit ,
	    -1 } ;

int	TransactionIndex [INDEX_SZ] = { e_time ,
	    e_sql_commands, e_prepares , e_executes , e_write_trans ,
	    e_commits , e_rollbacks , 
	    -1 } ;

int	Strategie1Index [INDEX_SZ] = { e_time ,
	    e_table_scan_acc ,
	    e_table_scan_read , e_table_scan_qual ,
	    e_key_acc ,
	    e_key_read , e_key_qual ,
            e_key_range_acc ,
	    e_key_range_read, e_key_range_qual ,
	    e_index_acc ,
	    e_index_read,  e_index_qual ,
	    -1 } ;

int	Strategie2Index [INDEX_SZ] = { e_time ,
	    e_index_range_acc ,
	    e_index_range_read , e_index_range_qual ,
	    e_iso_index_acc ,
	    e_iso_index_read , e_iso_index_qual ,
	    e_iso_index_range_acc ,
	    e_iso_index_range_read, e_iso_index_range_qual ,
	    e_iso_index_scan_acc ,
            e_iso_index_scan_read , e_iso_index_scan_qual ,
	    -1 } ;

int     Strategie3Index [INDEX_SZ] = { e_time ,
            e_table_scan_acc ,
            e_table_scan_read , e_table_scan_qual ,
            e_key_acc ,
            e_key_read , e_key_qual ,
            e_key_range_acc ,
            e_key_range_read, e_key_range_qual ,
            e_index_acc ,
            e_index_read,  e_index_qual ,
            e_index_range_acc ,
            e_index_range_read , e_index_range_qual ,
	    e_iso_index_acc ,
	    e_iso_index_read , e_iso_index_qual ,
	    e_iso_index_range_acc ,
	    e_iso_index_range_read, e_iso_index_range_qual ,
	    e_iso_index_scan_acc ,
            e_iso_index_scan_read , e_iso_index_scan_qual ,
            -1 } ;

int	Region1Index [INDEX_SZ] = { e_time ,
	    e_convert_reg_get,e_convert_reg_col,
/*
	    e_lock_reg_get, e_lock_reg_col,
*/
	    e_datan_reg_get ,e_datan_reg_col ,
	    e_tree_reg_get,e_tree_reg_col,
	    e_splittn_reg_get,e_splittn_reg_col,
	    -1 } ;

int     Region2Index [INDEX_SZ] = { e_time ,
            e_log_reg_get,e_log_reg_col,
            e_logwrite_reg_get,e_logwrite_reg_col,
            e_permfdir_reg_get,e_permfdir_reg_col,
            e_tempfdir_reg_get,e_tempfdir_reg_col,
	    e_trace_reg_get, e_trace_reg_col ,
            -1 } ;

int	R3RegionIndex [INDEX_SZ] = { e_time ,
	    e_convert_reg_get,e_convert_reg_col,
/*
	    e_lock_reg_get, e_lock_reg_col,
*/
	    e_datan_reg_get ,e_datan_reg_col ,
	    e_tree_reg_get,e_tree_reg_col,
	    e_splittn_reg_get,e_splittn_reg_col,
            e_log_reg_get,e_log_reg_col,
            e_logwrite_reg_get,e_logwrite_reg_col,
            e_permfdir_reg_get,e_permfdir_reg_col,
            e_tempfdir_reg_get,e_tempfdir_reg_col,
	    e_trace_reg_get, e_trace_reg_col ,
            -1 } ;

int     CacheIndex [INDEX_SZ] = { e_time ,
	   e_datacache_acc , e_datacache_hit ,
	   e_cacache_acc , e_cacache_hit ,
	   e_cocache_acc , e_cocache_hit ,
	   e_datan_reg_col, e_convert_reg_col,
	   e_cache_swaps ,
	   -1 } ;

int	OutputIndex [INDEX_SZ] = { e_time ,
	    e_phys_reads, e_phys_writes ,
            e_self_io_cnt_user, e_self_io_time_user ,
  	    e_dev_io_cnt_user, e_dev_io_time_user ,
            e_self_io_cnt_serv, e_self_pg_write_cnt_serv, e_self_io_time_serv ,
  	    e_dev_io_cnt_serv, e_dev_pg_write_cnt_serv, e_dev_io_time_serv ,
	    -1 } ; 

int	TempIndex [INDEX_SZ] = { e_time ,
            e_temp_page_reads, e_temp_page_writes,
            e_temp_page_vreads, e_temp_page_vwrites,	
	    -1 } ;

int	LockIndex [INDEX_SZ] = { e_time ,
	    e_lock_row_entries , e_lock_table_entries , e_lock_colls ,
	    e_wait_cnt_user , e_vwait_time_user , 
	    e_transn_reg_get , e_transn_reg_col ,
	    e_tabn_reg_get , e_tabn_reg_col ,
	    e_rown_reg_get , e_rown_reg_col ,
/*
	    e_lock_reg_get, e_lock_reg_col,
*/
	    e_kb_calls, 
	    -1 } ;

int	Dispatcher1Index [INDEX_SZ] = { e_time , 
	    e_total_disp_calls ,  e_total_commands , e_total_prio , 
	    e_total_prio_fom_oth , e_total_prio_com_queue ,
	    e_total_prio_rav_queue , e_total_prio_commit ,
	    -1 } ;
	
int	Dispatcher2Index [INDEX_SZ] = { e_time , 
	    e_total_disp_calls ,  
            e_total_state_vwait , e_total_state_vsuspend ,
            e_total_state_vsleep ,
	    e_total_reg_access , e_total_reg_collision ,
	    e_total_reg_wait ,
	    e_begexcl_tas_coll , e_endexcl_tas_coll , 
	    -1 } ;
	
int     Dispatcher3Index [INDEX_SZ] = { e_time ,
	    e_total_disp_calls ,  e_total_commands , e_total_prio , 
	    e_total_prio_fom_oth , e_total_prio_com_queue ,
	    e_total_prio_rav_queue , e_total_prio_commit ,
            e_total_state_vwait , e_total_state_vsuspend ,
            e_total_state_vsleep ,
	    e_total_reg_access , e_total_reg_collision ,
	    e_total_reg_wait ,
	    e_begexcl_tas_coll , e_endexcl_tas_coll , 
	    -1 } ;

struct wizs {
        int	len ;
	DType   DataType ;
	char	Tit [10] ;
	char    FTit [10] ;
	char	FDat [10] ;
	}  ;
	

#ifdef old
struct wizs S [] =
    { 
	{ 8, Time , "Time" , "%8s" , "%8s" } , 
/* Caches */
	{ 7, Int , "DaA" , "%7s" , "%7d" } , 
	{ 7, Int , "CaA" , "%7s" , "%7d" } ,
	{ 7, Int , "CoA" , "%7s" , "%7d" } ,
	{ 4, Int , "DaH" , "%4s" , "%4d" } , 
	{ 4, Int , "CaH" , "%4s" , "%4d" } ,
	{ 4, Int , "CoH" , "%4s" , "%4d" } ,
/* Commands */
	{ 6, Int , "Sql" , "%6s" , "%6d" } ,
	{ 6, Int , "Pre" , "%6s" , "%6d" } ,
	{ 6, Int , "Exe" , "%6s" , "%6d" } ,
	{ 6, Int , "Com" , "%6s" , "%6d" } ,
	{ 6, Int , "Rolb" , "%6s" , "%6d" } ,
/* Accesses */
	{ 6, Int , "SeA" , "%6s" , "%6d" } ,
	{ 6, Int , "InsA" , "%6s" , "%6d" } ,
	{ 6, Int , "UpdA" , "%6s" , "%6d" } ,
	{ 6, Int , "DelA" , "%6s" , "%6d" } ,
	{ 5, Int , "KeyA" , "%5s" , "%5d" } ,
	{ 5, Int , "KRaA" , "%5s" , "%5d" } ,
	{ 5, Int , "IndA" , "%5s" , "%5d" } ,
	{ 5, Int , "IRaA" , "%5s" , "%5d" } ,
	{ 5, Int , "IsIA" , "%5s" , "%5d" } ,
	{ 5, Int , "IIRA" , "%5s" , "%5d" } ,
	{ 5, Int , "IISA" , "%5s" , "%5d" } ,
	{ 5, Int , "TscA" , "%5s" , "%5d" } ,
/* Read */
	{ 6, Int , "SeR" , "%6s" , "%6d" } ,
	{ 6, Int , "UpdR" , "%6s" , "%6d" } ,
	{ 6, Int , "DelR" , "%6s" , "%6d" } ,
	{ 6, Int , "KeyR" , "%6s" , "%6d" } ,
	{ 6, Int , "KRaR" , "%6s" , "%6d" } ,
	{ 6, Int , "IndR" , "%6s" , "%6d" } ,
	{ 6, Int , "IRaR" , "%6s" , "%6d" } ,
	{ 6, Int , "IsIR" , "%6s" , "%6d" } ,
	{ 6, Int , "IIRR" , "%6s" , "%6d" } ,
	{ 6, Int , "IISR" , "%6s" , "%6d" } ,
	{ 6, Int , "TscR" , "%6s" , "%6d" } ,
/* Qual */
	{ 6, Int , "SeQ" , "%6s" , "%6d" } ,
	{ 6, Int , "InsQ" , "%6s" , "%6d" } ,
	{ 6, Int , "UpdQ" , "%6s" , "%6d" } ,
	{ 6, Int , "DelQ" , "%6s" , "%6d" } ,
	{ 6, Int , "KeyQ" , "%6s" , "%6d" } ,
	{ 6, Int , "KRaQ" , "%6s" , "%6d" } ,
	{ 6, Int , "IndQ" , "%6s" , "%6d" } ,
	{ 6, Int , "IRaQ" , "%6s" , "%6d" } ,
	{ 6, Int , "IsIQ" , "%6s" , "%6d" } ,
	{ 6, Int , "IIRQ" , "%6s" , "%6d" } ,
	{ 6, Int , "IISQ" , "%6s" , "%6d" } ,
	{ 6, Int , "TscQ" , "%6s" , "%6d" } ,
/* Strategien */
	{ 6, Float , "SeH" , "%6s" , "%6.1f" } ,
	{ 6, Float , "UpdH" , "%6s" , "%6.1f" } ,
	{ 6, Float , "DelH" , "%6s" , "%6.1f" } ,
	{ 6, Float , "KeyH" , "%6s" , "%6.1f" } ,
	{ 6, Float , "KRaH" , "%6s" , "%6.1f" } ,
	{ 6, Float , "IndH" , "%6s" , "%6.1f" } ,
	{ 6, Float , "IRaH" , "%6s" , "%6.1f" } ,
	{ 6, Float , "IsIH" , "%6s" , "%6.1f" } ,
	{ 6, Float , "IISH" , "%6s" , "%6.1f" } ,
	{ 6, Float , "IIRS" , "%6s" , "%6.1f" } ,
	{ 6, Float , "TaSH" , "%6s" , "%6.1f" } ,
/* Locks */
	{ 6, Int , "LoCol" , "%6s" , "%6d" } ,
	{ 5, Int , "LocR" , "%5s" , "%5d" } ,
	{ 5, Int , "LocT" , "%5s" , "%5d" } ,
	{ 6, Int , "Kb05" , "%6s" , "%6d" } ,
/* Log */
	{ 4, Int , "LgR" , "%4s" , "%4d" } ,
	{ 5, Int , "LgW" , "%5s" , "%5d" } ,
	{ 6, Int , "LgI" , "%6s" , "%6d" } ,
	{ 4, Int , "LGC" , "%4s" , "%4d" } ,
	{ 4, Int , "LOv" , "%4s" , "%4d" } ,
/* Misc */
	{ 5, Int , "PhR" , "%5s" , "%5d" } ,
	{ 5, Int , "PhW" , "%5s" , "%5d" } ,
	{ 4, Int , "TPR" , "%4s" , "%4d" } ,
	{ 4, Int , "TPW" , "%4s" , "%4d" } ,
	{ 6, Int , "TPVR" , "%6s" , "%6d" } ,
	{ 6, Int , "TPVW" , "%6s" , "%6d" } ,
	{ 5, Int , "WTr" , "%5s" , "%5d" } ,
/* x_cons Tasks */
	{ 4, Int , "WaC"     , "%4s" , "%4d" } ,
	{ 6, Float , "WaTm"  , "%6s" , "%6.2f" } ,
	{ 6, Int , "SuC"     , "%6s" , "%6d" } ,
	{ 5, Float , "SuTm"  , "%5s" , "%5.2f" } ,
	{ 6, Float , "RRTm"  , "%6s" , "%6.3f" } ,
	{ 4, Int , "LoC"     , "%4s" , "%4d" } ,
	{ 5, Float , "UDio"  , "%5s" , "%5.0f" } ,
	{ 6, Float , "UDioT" , "%6s" , "%6.3f" } ,
	{ 5, Float , "USio"  , "%5s" , "%5.0f" } ,
	{ 6, Float , "USioT" , "%6s" , "%6.3f" } ,
	{ 6, Int , "CSwp"    , "%6s" , "%6d" } ,
/* x_cons Tasks (Server) */
	{ 5, Float , "SDio"  , "%5s" , "%5.0f" } ,
	{ 5, Float , "SDiP" ,  "%5s" , "%5.0f" } ,
	{ 6, Float , "SDioT" , "%6s" , "%6.3f" } ,
	{ 5, Float , "SSio"  , "%5s" , "%5.0f" } ,
	{ 5, Float , "SSiP" ,  "%5s" , "%5.0f" } ,
	{ 6, Float , "SSioT" , "%6s" , "%6.3f" } ,
/* x_cons Tasks Logwriter1 */
	{ 5, Float , "Dio"  , "%5s" , "%5.0f" } ,
	{ 5, Float , "DioP" , "%5s" , "%5.0f" } ,
	{ 6, Float , "DioT" , "%6s" , "%6.3f" } ,
	{ 5, Float , "Sio"  , "%5s" , "%5.0f" } ,
	{ 5, Float , "SioP" , "%5s" , "%5.0f" } ,
	{ 6, Float , "SioT" , "%6s" , "%6.3f" } ,
/* x_cons Region Get */
	{ 7, Int , "CoRG" , "%7s" , "%7d" } ,
	{ 7, Int , "FbRG" , "%7s" , "%7d" } ,
	{ 7, Int , "DaRG" , "%7s" , "%7d" } ,
	{ 7, Int , "LcRG" , "%7s" , "%7d" } ,
	{ 7, Int , "LoRG" , "%7s" , "%7d" } ,
	{ 7, Int , "LwRG" , "%7s" , "%7d" } ,
	{ 7, Int , "PdRG" , "%7s" , "%7d" } ,
	{ 7, Int , "TdRG" , "%7s" , "%7d" } ,
	{ 7, Int , "TrRG" , "%7s" , "%7d" } ,
	{ 7, Int , "DnRG" , "%7s" , "%7d" } ,
	{ 7, Int , "TnRG" , "%7s" , "%7d" } ,
	{ 7, Int , "SnRG" , "%7s" , "%7d" } ,
	{ 7, Int , "TrRG" , "%7s" , "%7d" } ,
	{ 7, Int , "TaRG" , "%7s" , "%7d" } ,
	{ 7, Int , "RoRG" , "%7s" , "%7d" } ,
/* x_cons Region Col */
	{ 6, Float , "CoRC" , "%6s" , "%6.1f" } ,
	{ 6, Float , "FbRC" , "%6s" , "%6.1f" } ,
	{ 6, Float , "DaRC" , "%6s" , "%6.1f" } ,
	{ 6, Float , "LcRC" , "%6s" , "%6.1f" } ,
	{ 6, Float , "LoRC" , "%6s" , "%6.1f" } ,
	{ 6, Float , "LwRC" , "%6s" , "%6.1f" } ,
	{ 6, Float , "PdRC" , "%6s" , "%6.1f" } ,
	{ 6, Float , "TdRC" , "%6s" , "%6.1f" } ,
	{ 6, Float , "TrRC" , "%6s" , "%6.1f" } ,
	{ 6, Float , "DnRC" , "%6s" , "%6.1f" } ,
	{ 6, Float , "TnRC" , "%6s" , "%6.1f" } ,
	{ 6, Float , "SnRC" , "%6s" , "%6.1f" } ,
	{ 6, Float , "TrRC" , "%6s" , "%6.1f" } ,
	{ 6, Float , "TaRC" , "%6s" , "%6.1f" } ,
	{ 6, Float , "RoRC" , "%6s" , "%6.1f" } ,
/* x_cons All */
	{ 6,Float , "RCol" , "%6s" , "%6.1f" } ,
	{ 8,Float , "ToDC" , "%8s" , "%8.0f" } ,
	{ 8,Float , "TotCo" , "%8s" , "%8.0f" } ,
	{ 8,Float , "TotPr" , "%8s" , "%8.0f" } ,
	{ 8,Float , "TPrFO" , "%8s" , "%8.0f" } ,
	{ 8,Float , "TPrCQ" , "%8s" , "%8.0f" } ,
	{ 8,Float , "TPrRQ" , "%8s" , "%8.0f" } ,
	{ 8,Float , "TPrCo" , "%8s" , "%8.0f" } ,
	{ 8,Float , "TRegA" , "%8s" , "%8.0f" } ,
	{ 8,Float , "TBgTC" , "%8s" , "%8.0f" } ,
	{ 8,Float , "TReCo" , "%8s" , "%8.0f" } ,
	{ 8,Float , "TEnTC" , "%8s" , "%8.0f" } ,
	{ 8,Float , "TReWa" , "%8s" , "%8.0f" } ,
	{ 7,Float , "ToVwa" , "%7s" , "%7.0f" } ,
	{ 8,Float , "ToSus" , "%8s" , "%8.0f" } ,
	{ 8,Float , "ToSle" , "%8s" , "%8.0f" } ,
    }  ;
#else
	struct wizs S [] =
    { 
	{ 18,  Time , "Time" , "%18s" , "%18s" } , 
/* Caches */
	{ 18,  Int , "DaA" , "%18s" , "%18d" } , 
	{ 18,  Int , "CaA" , "%18s" , "%18d" } ,
	{ 18,  Int , "CoA" , "%18s" , "%18d" } ,
	{ 18,  Int , "DaH" , "%18s" , "%18d" } , 
	{ 18,  Int , "CaH" , "%18s" , "%18d" } ,
	{ 18,  Int , "CoH" , "%18s" , "%18d" } ,
/* Commands */
	{ 18,  Int , "Sql" , "%18s" , "%18d" } ,
	{ 18,  Int , "Pre" , "%18s" , "%18d" } ,
	{ 18,  Int , "Exe" , "%18s" , "%18d" } ,
	{ 18,  Int , "Com" , "%18s" , "%18d" } ,
	{ 18,  Int , "Rolb" , "%18s" , "%18d" } ,
/* Accesses */
	{ 18,  Int , "SeA" , "%18s" , "%18d" } ,
	{ 18,  Int , "InsA" , "%18s" , "%18d" } ,
	{ 18,  Int , "UpdA" , "%18s" , "%18d" } ,
	{ 18,  Int , "DelA" , "%18s" , "%18d" } ,
	{ 18,  Int , "KeyA" , "%18s" , "%18d" } ,
	{ 18,  Int , "KRaA" , "%18s" , "%18d" } ,
	{ 18,  Int , "IndA" , "%18s" , "%18d" } ,
	{ 18,  Int , "IRaA" , "%18s" , "%18d" } ,
	{ 18,  Int , "IsIA" , "%18s" , "%18d" } ,
	{ 18,  Int , "IIRA" , "%18s" , "%18d" } ,
	{ 18,  Int , "IISA" , "%18s" , "%18d" } ,
	{ 18,  Int , "TscA" , "%18s" , "%18d" } ,
/* Read */
	{ 18,  Int , "SeR" , "%18s" , "%18d" } ,
	{ 18,  Int , "UpdR" , "%18s" , "%18d" } ,
	{ 18,  Int , "DelR" , "%18s" , "%18d" } ,
	{ 18,  Int , "KeyR" , "%18s" , "%18d" } ,
	{ 18,  Int , "KRaR" , "%18s" , "%18d" } ,
	{ 18,  Int , "IndR" , "%18s" , "%18d" } ,
	{ 18,  Int , "IRaR" , "%18s" , "%18d" } ,
	{ 18,  Int , "IsIR" , "%18s" , "%18d" } ,
	{ 18,  Int , "IIRR" , "%18s" , "%18d" } ,
	{ 18,  Int , "IISR" , "%18s" , "%18d" } ,
	{ 18,  Int , "TscR" , "%18s" , "%18d" } ,
/* Qual */
	{ 18,  Int , "SeQ" , "%18s" , "%18d" } ,
	{ 18,  Int , "InsQ" , "%18s" , "%18d" } ,
	{ 18,  Int , "UpdQ" , "%18s" , "%18d" } ,
	{ 18,  Int , "DelQ" , "%18s" , "%18d" } ,
	{ 18,  Int , "KeyQ" , "%18s" , "%18d" } ,
	{ 18,  Int , "KRaQ" , "%18s" , "%18d" } ,
	{ 18,  Int , "IndQ" , "%18s" , "%18d" } ,
	{ 18,  Int , "IRaQ" , "%18s" , "%18d" } ,
	{ 18,  Int , "IsIQ" , "%18s" , "%18d" } ,
	{ 18,  Int , "IIRQ" , "%18s" , "%18d" } ,
	{ 18,  Int , "IISQ" , "%18s" , "%18d" } ,
	{ 18,  Int , "TscQ" , "%18s" , "%18d" } ,
/* Strategien */
	{ 18,  Float , "SeH" , "%18s" , "%18.1f" } ,
	{ 18,  Float , "UpdH" , "%18s" , "%18.1f" } ,
	{ 18,  Float , "DelH" , "%18s" , "%18.1f" } ,
	{ 18,  Float , "KeyH" , "%18s" , "%18.1f" } ,
	{ 18,  Float , "KRaH" , "%18s" , "%18.1f" } ,
	{ 18,  Float , "IndH" , "%18s" , "%18.1f" } ,
	{ 18,  Float , "IRaH" , "%18s" , "%18.1f" } ,
	{ 18,  Float , "IsIH" , "%18s" , "%18.1f" } ,
	{ 18,  Float , "IISH" , "%18s" , "%18.1f" } ,
	{ 18,  Float , "IIRS" , "%18s" , "%18.1f" } ,
	{ 18,  Float , "TaSH" , "%18s" , "%18.1f" } ,
/* Locks */
	{ 18,  Int , "LoCol" , "%18s" , "%18d" } ,
	{ 18,  Int , "LocR" , "%18s" , "%18d" } ,
	{ 18,  Int , "LocT" , "%18s" , "%18d" } ,
	{ 18,  Int , "Kb05" , "%18s" , "%18d" } ,
/* Log */
	{ 18,  Int , "LgR" , "%18s" , "%18d" } ,
	{ 18,  Int , "LgW" , "%18s" , "%18d" } ,
	{ 18,  Int , "LgI" , "%18s" , "%18d" } ,
	{ 18,  Int , "LGC" , "%18s" , "%18d" } ,
	{ 18,  Int , "LOv" , "%18s" , "%18d" } ,
/* Misc */
	{ 18,  Int , "PhR" , "%18s" , "%18d" } ,
	{ 18,  Int , "PhW" , "%18s" , "%18d" } ,
	{ 18,  Int , "TPR" , "%18s" , "%18d" } ,
	{ 18,  Int , "TPW" , "%18s" , "%18d" } ,
	{ 18,  Int , "TPVR" , "%18s" , "%18d" } ,
	{ 18,  Int , "TPVW" , "%18s" , "%18d" } ,
	{ 18,  Int , "WTr" , "%18s" , "%18d" } ,
/* x_cons Tasks */
	{ 18,  Int , "WaC"     , "%18s" , "%18d" } ,
	{ 18,  Float , "WaTm"  , "%18s" , "%18.2f" } ,
	{ 18,  Int , "SuC"     , "%18s" , "%18d" } ,
	{ 18,  Float , "SuTm"  , "%18s" , "%18.2f" } ,
	{ 18,  Float , "RRTm"  , "%18s" , "%18.3f" } ,
	{ 18,  Int , "LoC"     , "%18s" , "%18d" } ,
	{ 18,  Float , "UDio"  , "%18s" , "%18.0f" } ,
	{ 18,  Float , "UDioT" , "%18s" , "%18.3f" } ,
	{ 18,  Float , "USio"  , "%18s" , "%18.0f" } ,
	{ 18,  Float , "USioT" , "%18s" , "%18.3f" } ,
	{ 18,  Int , "CSwp"    , "%18s" , "%18d" } ,
/* x_cons Tasks (Server) */
	{ 18,  Float , "SDio"  , "%18s" , "%18.0f" } ,
	{ 18,  Float , "SDiP" ,  "%18s" , "%18.0f" } ,
	{ 18,  Float , "SDioT" , "%18s" , "%18.3f" } ,
	{ 18,  Float , "SSio"  , "%18s" , "%18.0f" } ,
	{ 18,  Float , "SSiP" ,  "%18s" , "%18.0f" } ,
	{ 18,  Float , "SSioT" , "%18s" , "%18.3f" } ,
/* x_cons Tasks Logwriter1 */
	{ 18,  Float , "Dio"  , "%18s" , "%18.0f" } ,
	{ 18,  Float , "DioP" , "%18s" , "%18.0f" } ,
	{ 18,  Float , "DioT" , "%18s" , "%18.3f" } ,
	{ 18,  Float , "Sio"  , "%18s" , "%18.0f" } ,
	{ 18,  Float , "SioP" , "%18s" , "%18.0f" } ,
	{ 18,  Float , "SioT" , "%18s" , "%18.3f" } ,
/* x_cons Region Get */
	{ 18,  Int , "CoRG" , "%18s" , "%18d" } ,
	{ 18,  Int , "FbRG" , "%18s" , "%18d" } ,
	{ 18,  Int , "DaRG" , "%18s" , "%18d" } ,
	{ 18,  Int , "LcRG" , "%18s" , "%18d" } ,
	{ 18,  Int , "LoRG" , "%18s" , "%18d" } ,
	{ 18,  Int , "LwRG" , "%18s" , "%18d" } ,
	{ 18,  Int , "PdRG" , "%18s" , "%18d" } ,
	{ 18,  Int , "TdRG" , "%18s" , "%18d" } ,
	{ 18,  Int , "TrRG" , "%18s" , "%18d" } ,
	{ 18,  Int , "DnRG" , "%18s" , "%18d" } ,
	{ 18,  Int , "TnRG" , "%18s" , "%18d" } ,
	{ 18,  Int , "SnRG" , "%18s" , "%18d" } ,
	{ 18,  Int , "TrRG" , "%18s" , "%18d" } ,
	{ 18,  Int , "TaRG" , "%18s" , "%18d" } ,
	{ 18,  Int , "RoRG" , "%18s" , "%18d" } ,
/* x_cons Region Col */
	{ 18,  Float , "CoRC" , "%18s" , "%18.1f" } ,
	{ 18,  Float , "FbRC" , "%18s" , "%18.1f" } ,
	{ 18,  Float , "DaRC" , "%18s" , "%18.1f" } ,
	{ 18,  Float , "LcRC" , "%18s" , "%18.1f" } ,
	{ 18,  Float , "LoRC" , "%18s" , "%18.1f" } ,
	{ 18,  Float , "LwRC" , "%18s" , "%18.1f" } ,
	{ 18,  Float , "PdRC" , "%18s" , "%18.1f" } ,
	{ 18,  Float , "TdRC" , "%18s" , "%18.1f" } ,
	{ 18,  Float , "TrRC" , "%18s" , "%18.1f" } ,
	{ 18,  Float , "DnRC" , "%18s" , "%18.1f" } ,
	{ 18,  Float , "TnRC" , "%18s" , "%18.1f" } ,
	{ 18,  Float , "SnRC" , "%18s" , "%18.1f" } ,
	{ 18,  Float , "TrRC" , "%18s" , "%18.1f" } ,
	{ 18,  Float , "TaRC" , "%18s" , "%18.1f" } ,
	{ 18,  Float , "RoRC" , "%18s" , "%18.1f" } ,
/* x_cons All */
	{ 18, Float , "RCol" , "%18s" , "%18.1f" } ,
	{ 18, Float , "ToDC" , "%18s" , "%18.0f" } ,
	{ 18, Float , "TotCo" , "%18s" , "%18.0f" } ,
	{ 18, Float , "TotPr" , "%18s" , "%18.0f" } ,
	{ 18, Float , "TPrFO" , "%18s" , "%18.0f" } ,
	{ 18, Float , "TPrCQ" , "%18s" , "%18.0f" } ,
	{ 18, Float , "TPrRQ" , "%18s" , "%18.0f" } ,
	{ 18, Float , "TPrCo" , "%18s" , "%18.0f" } ,
	{ 18, Float , "TRegA" , "%18s" , "%18.0f" } ,
	{ 18, Float , "TBgTC" , "%18s" , "%18.0f" } ,
	{ 18, Float , "TReCo" , "%18s" , "%18.0f" } ,
	{ 18, Float , "TEnTC" , "%18s" , "%18.0f" } ,
	{ 18, Float , "TReWa" , "%18s" , "%18.0f" } ,
	{ 18, Float , "ToVwa" , "%18s" , "%18.0f" } ,
	{ 18, Float , "ToSus" , "%18s" , "%18.0f" } ,
	{ 18, Float , "ToSle" , "%18s" , "%18.0f" } ,
    }  ;
#endif

static void WriteTitle ( ) ;
static void WriteData ( ) ;
static void PrintWizNumeric( ) ;
static void PrintWizString ( ) ;
static int  Max100 () ;
static float  Percent () ;
static void OpenOutputFile ( ) ; 
static void ErrEx () ; 
static void usage () ;

struct MonS 	mon ;
struct RegS		reg ;
struct t_c_s 	tas [11] ;
struct XconsAllS tct ;
int    PerMinute = 0 ;

#define CP_IND(x) memcpy ( Index , x , sizeof Index )

time_t WT ;

int    R3 = 0 ;
float  pm = 1.0 ;
/* Adis 1104791 */
FILE   *fo ;

main (argc,argv) 
char	**argv ;
{
    char	*filename = "x_wizard.bin" ;
    char	DateFile [256] ;
    int 	i ;
    int		Initial = 1 ;
    int		NewPage = 0 ;
    int		Lines = 0 ;
	/* Adis 1104791 */
	fo = stdout ;
    
	CP_IND ( OverviewIndex ) ;
	
    for (i=1; i < argc ; i++)
    {
        if (argv[i][0] == '-')
        {
            switch (argv[i][1])
            {
			case '3' : R3 = 1 ; 
				break ;
			case 'D' : sprintf( DateFile , "%s.wbi" , argv [++i] ) ;
				filename = DateFile ;
				OpenOutputFile ( argv [i] ) ;
				break ;		
			}
		}
    }
	
    for (i=1; i < argc ; i++)
    {
        if (argv[i][0] == '-')
        {
            switch (argv[i][1])
            {
			case 'o' : if ( R3 ) 
						   CP_IND ( R3OverviewIndex ) ;
				else
					CP_IND ( OverviewIndex ) ;
				fprintf (fo,"Overview\n") ;
				break ;
			case 'g' : CP_IND ( LogIndex ) ;
				fprintf (fo,"Logging activities\n") ;
				break ;
			case 'c' : CP_IND ( CommandIndex ) ;
				fprintf (fo,"SQL commands\n") ;
				break ;
			case 's' : if (R3)
						   CP_IND ( Strategie3Index ) ;
				else
					CP_IND ( Strategie1Index ) ;
				fprintf (fo,"Optimizer strategies\n") ;
				break ;
			case 'S' : CP_IND ( Strategie2Index ) ;
				fprintf (fo,"Optimizer strategies\n") ;
				break ;
			case 'r' : if ( R3 ) 
						   CP_IND ( R3RegionIndex ) ;
				else
					CP_IND ( Region1Index ) ;
				fprintf (fo,"Regions\n") ;
				break ;
			case 'R' : CP_IND ( Region2Index ) ;
				fprintf (fo,"Regions\n") ;
				break ;
			case 't' : CP_IND ( TransactionIndex ) ;
				fprintf (fo,"Transactions\n") ;
				break ;
			case 'T' : CP_IND ( TempIndex ) ;
				fprintf (fo,"Temp Pages\n") ;
				break ;
			case 'C' : CP_IND (CacheIndex ) ;
				fprintf (fo,"Caches\n") ;
				break ;
			case 'O' : CP_IND (OutputIndex) ;
				fprintf (fo,"I/O activities\n") ;
				break ;
			case 'l' : CP_IND (LockIndex) ;
				fprintf (fo,"Lock activities\n") ;
				break ;
			case 'i' : filename = argv [++i] ;
				break ;
			case 'h' : usage () ;
				exit (1) ;
			case 'P' : NewPage = atoi ( argv[++i] ) ; 
				break ;
			case 'd' : if ( R3 )	
						   CP_IND (Dispatcher3Index) ;
				else
					CP_IND (Dispatcher2Index) ;
				fprintf (fo,"Dispatcher\n") ;
				break ;
			case 'p' : CP_IND (Dispatcher1Index) ;
				fprintf (fo,"Prioritization\n") ;
				break ;
			case 'M' : PerMinute = 1 ;
				break ;
			case '3' : 
			case 'D' : break ;
			default  : fprintf (stderr , "Illegal Option -%c\n",
						   argv[i][1]) ;
				usage () ;
				exit (1) ;
			}
		}
    }

    if ( fbin == (FILE *) NULL )
&if $OS = WIN32
    if ( ( fbin = fopen ( filename , "rb" ) ) == NULL )
&else
    if ( ( fbin = fopen ( filename , "r" ) ) == NULL )
&endif
	ErrEx ( "ERROR open binary input file") ;

    while ( GetRecord () )
    {
	if ( PerMinute )
	    pm = 60.0 / (float) DTime ;

	if ( Initial )
	{
    	    fprintf (fo,"started : %s\n" , ctime (&WT) ) ;
    	    WriteTitle ( Index , 1 ) ;
	    Initial = 0 ;
	}

	WriteData ( Index ) ;
	if ( NewPage && ( ++Lines == NewPage ) ) 
	{
	    WriteTitle ( Index , 0 ) ;
	    Lines = 0 ;
	}
    }
}

&if $OS = WIN32
GetRecord () 
{
        char LocWizVersion [20] ;

        if ( fread ( LocWizVersion , 1, sizeof LocWizVersion , fbin ) != sizeof LocWizVersion )
	{   /* fprintf (fo,"Error beim Lesen von 'Version'\n"); */return 0 ; }
	if ( strcmp ( LocWizVersion , WizVersion ) )
	{
	    fprintf ( fo , "Corrupted binary file (Wizard version %s)\n" ,
		LocWizVersion ) ;
	    exit (1) ;
	}
        if ( fread ( &WT , 1, sizeof WT , fbin ) != sizeof WT )
	{   /* fprintf (fo,"Error beim Lesen von 'WT'\n"); */return 0 ; }
        if ( fread ( &DTime , 1, sizeof DTime , fbin ) != sizeof WT )
	{   /* fprintf (fo,"Error beim Lesen von 'DTime'\n"); */return 0 ; }
        if ( fread ( &mon , 1, sizeof (struct MonS)  , fbin ) != sizeof (struct MonS) )
	{   /* fprintf (fo,"Error beim Lesen von 'mon'\n"); */return 0 ; }
        if ( fread ( RegionData , 1, sizeof RegionData , fbin ) != sizeof RegionData )
	{   /* fprintf (fo,"Error beim Lesen von 'reg'\n"); */return 0 ; }
        if ( fread ( &tas , sizeof (tas) , 1 , fbin ) != 1 )
	{   /* fprintf (fo,"Error beim Lesen von 'tas'\n"); */return 0 ; }
        if ( fread ( &tct , sizeof (tct) , 1 , fbin ) != 1 )
	{   /* fprintf (fo,"Error beim Lesen von 'tct'\n"); */return 0 ; }
	return 1 ;
}
&else
GetRecord () 
{
        char LocWizVersion [20] ;

        if ( fread ( LocWizVersion , sizeof LocWizVersion , 1 ,fbin ) != 1 )
	{   /* fprintf (fo,"Error beim Lesen von 'Version'\n");*/ return 0 ; }

	if ( strcmp ( LocWizVersion , WizVersion ) ) 
	{
	    fprintf ( fo , "Corrupted binary file (Wizard version %s)" ,
		LocWizVersion ) ;
	    exit (1) ;
	}

        if ( fread ( &WT , sizeof WT , 1 , fbin ) != 1 )
	{   fprintf (fo,"Error beim Lesen von 'WT'\n"); return 0 ; }
        if ( fread ( &DTime , sizeof DTime , 1 , fbin ) != 1 )
	{   fprintf (fo,"Error beim Lesen von 'DTime'\n"); return 0 ; }
        if ( fread ( &mon , sizeof (struct MonS) , 1 , fbin ) != 1 )
	{   fprintf (fo,"Error beim Lesen von 'mon'\n"); return 0 ; }
        if ( fread ( RegionData , sizeof RegionData, 1 , fbin ) != 1 )
	{   fprintf (fo,"Error beim Lesen von 'reg'\n"); return 0 ; }
        if ( fread ( &tas , sizeof (tas) , 1 , fbin ) != 1 )
	{   fprintf (fo,"Error beim Lesen von 'tas'\n"); return 0 ; }
        if ( fread ( &tct , sizeof (tct) , 1 , fbin ) != 1 )
	{   fprintf (fo,"Error beim Lesen von 'tct'\n"); return 0 ; }
	return 1 ;
}
&endif

static void WriteTitle ( I , NewLine )
int	*I ;
int	NewLine ;
{
	int i ;
    
    for ( i = 0 ; I[i] >= 0 ; i++ )
    {
		fprintf (fo, S[I[i]].FTit , S[I[i]].Tit ) ;
		if (R3)
			fprintf (fo," ") ;
    }
    fprintf (fo,"\n") ;
	
    if ( NewLine ) 
		fprintf (fo,"\n") ;
}

#define PRD(x) \
    { \
	if ( S[ii].DataType != String ) \
	{ \
	    double z = (double) (x) ; \
	    PrintWizNumeric ( ii , z ) ; \
	} \
	else \
	    PrintWizString ( ii , x ) ; \
    } \
    break 

static void WriteData (I) 
int	*I ;
{
int i ,ii ;
float  zwi ;

    for ( i = 0 ; I[i] >= 0 ; i++ )
    {
	ii = I[i] ;

	switch (ii)
	{
	    case e_time :
		PRD (WT) ;
	    case e_datacache_acc : 
		PRD (pm*mon.DataCacheAccesses) ;
	    case e_cocache_acc : 
		PRD (pm*mon.ConverterCacheAccesses) ;
	    case e_cacache_acc : 
		PRD (pm*mon.CatalogCacheAccesses) ;
	    case e_datacache_hit : 
		PRD (Max100(mon.DataCacheHitRate)) ;
	    case e_cocache_hit : 
		PRD (Max100(mon.ConverterCacheHitRate)) ;
	    case e_cacache_hit : 
		PRD (Max100(mon.CatalogCacheHitRate)) ;
	    case e_executes :
		PRD (pm*mon.Executes) ;
	    case e_sql_commands :
		PRD (pm*mon.SqlCommands) ;
	    case e_write_trans : 
		PRD (pm*mon.WriteTransactions) ;
	    case e_commits : 
		PRD (pm*mon.Commits) ;
	    case e_rollbacks : 
		PRD (pm*mon.Rollbacks) ;
	    case e_prepares : 
		PRD (pm*mon.Prepares) ;
	    case e_phys_reads :
		PRD (pm*mon.PhysicalReads) ;
 	    case e_phys_writes :
		PRD (pm*mon.PhysicalWrites) ;
	    case e_temp_page_writes :
		PRD (pm*mon.TempPagePhysicalWrites) ;
	    case e_temp_page_vwrites :
		PRD (pm*mon.TempPageVirtualWrites) ;
	    case e_temp_page_reads :
		PRD (pm*mon.TempPagePhysicalReads) ;
	    case e_temp_page_vreads :
		PRD (pm*mon.TempPageVirtualReads) ;
	    case e_log_writes :
		PRD (pm*mon.LogPagePhysicalWrites) ;
	    case e_log_reads :
		PRD (pm*mon.LogPagePhysicalReads) ;
	    case e_log_queue_inserts :
		PRD (pm*mon.LogQueueInserts);
	    case e_log_queue_overfl :
		PRD (mon.LogQueueOverflows);
	    case e_group_commits :
		PRD (pm*mon.LogQueueGroupCommits);
	    case e_lock_colls :		
		PRD (pm*mon.LockListCollisions) ;
	    case e_lock_row_entries :
		PRD (pm*mon.LockListInsertedRowEntries) ;
	    case e_lock_table_entries :  
		PRD (pm*mon.LockListInsertedTableEntries) ;
	    case e_kb_calls :
		PRD (pm*mon.KbCalls) ;
	    case e_sel_acc :
		PRD (pm*mon.SelectsAndFetches) ;
 	    case e_ins_acc :
		PRD (pm*mon.Inserts) ;
 	    case e_upd_acc :
		PRD (pm*mon.Updates) ;
	    case e_del_acc :
		PRD (pm*mon.Deletes) ;
 	    case e_key_acc :
		PRD (pm*mon.PrimaryKeyAccesses) ;
 	    case e_key_range_acc :
		PRD (pm*mon.PrimaryKeyRangeAccesses) ;
 	    case e_index_acc :
		PRD (pm*mon.IndexAccesses) ;
            case e_index_range_acc :
		PRD (pm*mon.IndexRangeAccesses) ;
 	    case e_iso_index_acc :
		PRD (pm*mon.IsolatedIndexAccesses) ;
 	    case e_iso_index_range_acc :
		PRD (pm*mon.IsolatedIndexRangeAccesses) ;
	    case e_iso_index_scan_acc :
		PRD (pm*mon.IsolatedIndexScans) ;
            case e_table_scan_acc :
		PRD (pm*mon.TableScans) ;
            case e_sel_qual:
		PRD (pm*mon.SelectsAndFetchesRowsQual) ;
            case e_ins_qual:
		PRD (pm*mon.InsertsRowsInserted);
            case e_upd_qual:
		PRD (pm*mon.UpdatesRowsUpdated) ;
            case e_del_qual:
		PRD (pm*mon.DeletesRowsDeleted) ;
 	    case e_key_qual :
		PRD (pm*mon.PrimaryKeyAccessesRowsQual) ;
 	    case e_key_range_qual :
		PRD (pm*mon.PrimaryKeyRangeAccessesRowsQual) ;
 	    case e_index_qual :
		PRD (pm*mon.IndexAccessesRowsQual) ;
            case e_index_range_qual :
		PRD (pm*mon.IndexRangeAccessesRowsQual) ;
 	    case e_iso_index_qual :
		PRD (pm*mon.IsolatedIndexAccessesRowsQual) ;
 	    case e_iso_index_range_qual :
		PRD (pm*mon.IsolatedIndexRangeAccessesRowsQual) ;
	    case e_iso_index_scan_qual :
		PRD (pm*mon.IsolatedIndexScansRowsQual) ;
            case e_table_scan_qual :
		PRD (pm*mon.TableScansRowsQual) ;
            case e_sel_read:
		PRD (pm*mon.SelectsAndFetchesRowsRead) ;
            case e_upd_read:
		PRD (pm*mon.UpdatesRowsRead) ;
            case e_del_read:
		PRD (pm*mon.DeletesRowsRead) ;
 	    case e_key_read :
		PRD (pm*mon.PrimaryKeyAccessesRowsRead) ;
 	    case e_key_range_read :
		PRD (pm*mon.PrimaryKeyRangeAccessesRowsRead) ;
 	    case e_index_read :
		PRD (pm*mon.IndexAccessesRowsRead) ;
            case e_index_range_read :
		PRD (pm*mon.IndexRangeAccessesRowsRead) ;
 	    case e_iso_index_read :
		PRD (pm*mon.IsolatedIndexAccessesRowsRead) ;
 	    case e_iso_index_range_read :
		PRD (pm*mon.IsolatedIndexRangeAccessesRowsRead) ;
	    case e_iso_index_scan_read :
		PRD (pm*mon.IsolatedIndexScansRowsRead) ;
            case e_table_scan_read :
		PRD (pm*mon.TableScansRowsRead) ;
	    case e_sel_hit :
		zwi = Percent (mon.SelectsAndFetchesRowsQual
			,mon.SelectsAndFetchesRowsRead) ;
		PRD (zwi) ;
 	    case e_upd_hit :
		zwi = Percent (mon.UpdatesRowsUpdated, mon.UpdatesRowsRead) ;
		PRD (zwi) ;
	    case e_del_hit :
		zwi = Percent (mon.DeletesRowsDeleted,mon.DeletesRowsRead) ;
		PRD (zwi) ;
 	    case e_key_hit :
		zwi = Percent (mon.PrimaryKeyAccessesRowsQual
			,mon.PrimaryKeyAccessesRowsRead) ;
		PRD (zwi) ;
 	    case e_key_range_hit :
		zwi = Percent (mon.PrimaryKeyRangeAccessesRowsQual
			,mon.PrimaryKeyRangeAccessesRowsRead) ;
		PRD (zwi) ;
 	    case e_index_hit :
		zwi = Percent (mon.IndexAccessesRowsQual
			,mon.IndexAccessesRowsRead) ;
		PRD (zwi) ;
            case e_index_range_hit :
		zwi = Percent (mon.IndexRangeAccessesRowsQual
			,mon.IndexRangeAccessesRowsRead) ;
		PRD (zwi) ;
 	    case e_iso_index_hit :
		zwi = Percent (mon.IsolatedIndexAccessesRowsQual
			,mon.IsolatedIndexAccessesRowsRead) ;
		PRD (zwi) ;
 	    case e_iso_index_range_hit :
		zwi = Percent (mon.IsolatedIndexRangeAccessesRowsQual
			,mon.IsolatedIndexRangeAccessesRowsRead) ;
		PRD (zwi) ;
	    case e_iso_index_scan_hit :
		zwi = Percent (mon.IsolatedIndexScansRowsQual
			,mon.IsolatedIndexScansRowsRead) ;
		PRD (zwi) ;
            case e_table_scan_hit :
		zwi = Percent (mon.TableScansRowsQual
			,mon.TableScansRowsRead) ;
		PRD (zwi) ;
	    case e_wait_cnt_user :
		PRD (pm*tas[T_USER].state_vwait);
	    case e_vwait_time_user :
		zwi = tas[T_USER].state_vwait ?
		    tas[T_USER].avg_vwait_time/tas[T_USER].state_vwait : 0.0 ;
		PRD (zwi);
 	    case e_susp_cnt_user :
		PRD (pm*tas[T_USER].state_vsusp);
 	    case e_susp_time_user :
		zwi = tas[T_USER].state_vsusp ?
		    tas[T_USER].avg_vsusp_time/tas[T_USER].state_vsusp : 0.0 ;
		PRD (zwi);
	    case e_rcvrpl_time_user:
		zwi = tas[T_USER].rcv_rpl_count ? 
	            tas[T_USER].avg_rcv_rpl_t/tas[T_USER].rcv_rpl_count : 0.0;
		PRD (zwi);
	    case e_rcvrpl_long_user:
		PRD (pm*tas[T_USER].rcv_rpl_long);
	    case e_total_regcoll_rate:
		zwi = tct.total_reg_collision ?
		    tct.total_reg_collision/tct.total_reg_access*100.0 
		    : 0.0 ;
		PRD (zwi);
            case e_dev_io_write_cnt_log1:  
		PRD (pm*tas[T_LOGWR1].dev_io_writecnt) ;
            case e_dev_pg_write_cnt_log1:  
		PRD (pm*tas[T_LOGWR1].dev_pg_writecnt) ;
	    case e_dev_io_time_log1:
		zwi = tas[T_LOGWR1].dev_io_cnt ?
		    tas[T_LOGWR1].avg_dev_io_tm / tas[T_LOGWR1].dev_io_cnt :
		    0.0 ; 
		PRD (zwi) ;
	    case e_self_io_write_cnt_log1:
		PRD (pm*tas[T_LOGWR1].self_io_writecnt);
            case e_self_pg_write_cnt_log1:  
		PRD (pm*tas[T_LOGWR1].self_pg_writecnt) ;
	    case e_self_io_time_log1:
		zwi = tas[T_LOGWR1].self_io_cnt ?
		    tas[T_LOGWR1].avg_self_io_tm / tas[T_LOGWR1].self_io_cnt :
		    0.0 ; 
		PRD (zwi) ;

            case e_dev_io_cnt_user:
                PRD (pm*tas[T_USER].dev_io_cnt) ;
            case e_dev_io_time_user:
                zwi = tas[T_USER].dev_io_cnt ?
                    tas[T_USER].avg_dev_io_tm / tas[T_USER].dev_io_cnt :
                    0.0 ;
                PRD (zwi) ;
            case e_self_io_cnt_user:
                PRD (pm*tas[T_USER].self_io_cnt);
            case e_self_io_time_user:
                zwi = tas[T_USER].self_io_cnt ?
                    tas[T_USER].avg_self_io_tm / tas[T_USER].self_io_cnt :
                    0.0 ;
                PRD (zwi) ;

	    case e_cache_swaps :
		PRD (pm*tas[T_USER].self_io_writecnt+pm*tas[T_USER].dev_io_writecnt);
            case e_dev_io_cnt_serv:
                PRD (pm*tas[T_SERVER].dev_io_cnt) ;
            case e_dev_pg_write_cnt_serv:
                PRD (pm*tas[T_SERVER].dev_pg_writecnt) ;
            case e_dev_io_time_serv:
                zwi = tas[T_SERVER].dev_io_cnt ?
                    tas[T_SERVER].avg_dev_io_tm / tas[T_SERVER].dev_io_cnt :
                    0.0 ;
                PRD (zwi) ;
            case e_self_pg_write_cnt_serv:
                PRD (pm*tas[T_SERVER].self_pg_writecnt);
            case e_self_io_cnt_serv:
                PRD (pm*tas[T_SERVER].self_io_cnt);
            case e_self_io_time_serv:
                zwi = tas[T_SERVER].self_io_cnt ?
                    tas[T_SERVER].avg_self_io_tm / tas[T_SERVER].self_io_cnt :
                    0.0 ;
                PRD (zwi) ;

	    case e_convert_reg_get :
		PRD (pm*RegionData[R_CONVERT].GetCnt) ;
	    case e_fbm_reg_get :
		PRD (pm*RegionData[R_FBM].GetCnt) ;
	    case e_data_reg_get :
		PRD (pm*RegionData[R_DATACACH].GetCnt) ;
/*
	    case e_lock_reg_get :
		PRD (pm*RegionData[R_LOCK].GetCnt) ;
*/
	    case e_log_reg_get :
		PRD (pm*RegionData[R_LOG].GetCnt) ;
	    case e_logwrite_reg_get :
		PRD (pm*RegionData[R_LOGWRITE].GetCnt) ;
	    case e_permfdir_reg_get :
		PRD (pm*RegionData[R_PERMFDIR].GetCnt) ;
	    case e_tempfdir_reg_get :
		PRD (pm*RegionData[R_TEMPFDIR].GetCnt) ;
	    case e_trace_reg_get :
		PRD (pm*RegionData[R_TRACE].GetCnt) ;
	    case e_datan_reg_get  :
		PRD (pm*RegionData[R_DATAn].GetCnt) ;
	    case e_tree_reg_get :
		PRD (pm*RegionData[R_TREEn].GetCnt) ;
	    case e_splittn_reg_get :
		PRD (pm*RegionData[R_SPLITTn].GetCnt) ;
	    case e_transn_reg_get :
		PRD (pm*RegionData[R_TRANSn].GetCnt) ;
	    case e_tabn_reg_get :
		PRD (pm*RegionData[R_TABn].GetCnt) ;
	    case e_rown_reg_get :
		PRD (pm*RegionData[R_ROWn].GetCnt) ;

	    case e_convert_reg_col :
		PRD (RegionData[R_CONVERT].CollProz) ;
	    case e_fbm_reg_col :
		PRD (RegionData[R_FBM].CollProz) ;
	    case e_data_reg_col :
		PRD (RegionData[R_DATACACH].CollProz) ;
/*
	    case e_lock_reg_col :
		PRD (RegionData[R_LOCK].CollProz) ;
*/
	    case e_log_reg_col :
		PRD (RegionData[R_LOG].CollProz) ;
	    case e_logwrite_reg_col :
		PRD (RegionData[R_LOGWRITE].CollProz) ;
	    case e_permfdir_reg_col :
		PRD (RegionData[R_PERMFDIR].CollProz) ;
	    case e_tempfdir_reg_col :
		PRD (RegionData[R_TEMPFDIR].CollProz) ;
	    case e_trace_reg_col :
		PRD (RegionData[R_TRACE].CollProz) ;
	    case e_datan_reg_col  :
		PRD (RegionData[R_DATAn].CollProz) ;
	    case e_tree_reg_col :
		PRD (RegionData[R_TREEn].CollProz) ;
	    case e_splittn_reg_col :
		PRD (RegionData[R_SPLITTn].CollProz) ;
	    case e_transn_reg_col :
		PRD (RegionData[R_TRANSn].CollProz) ;
	    case e_tabn_reg_col :
		PRD (RegionData[R_TABn].CollProz) ;
	    case e_rown_reg_col :
		PRD (RegionData[R_ROWn].CollProz) ;

	    case e_total_disp_calls :
	        PRD ( pm*tct.total_disp_calls) ;
	    case e_total_commands :
	        PRD ( pm*tct.total_commands) ;
            case e_total_prio :
	        PRD ( pm*tct.total_prio) ;
	    case e_total_prio_fom_oth :
	        PRD ( pm*tct.total_prio_from_oth) ;
	    case e_total_prio_com_queue :
	        PRD ( pm*tct.total_prio_com_queue) ;
            case e_total_prio_rav_queue :
	        PRD ( pm*tct.total_prio_rav_queue) ;
            case e_total_prio_commit :
	        PRD ( pm*tct.total_prio_commit) ;
	    case e_total_reg_access :
	        PRD ( pm*tct.total_reg_access) ;
            case e_begexcl_tas_coll :
	        PRD ( pm*tct.begexcl_tas_coll) ;
	    case e_total_reg_collision :
	        PRD ( pm*tct.total_reg_collision) ;
            case e_endexcl_tas_coll :
	        PRD ( pm*tct.endexcl_tas_coll) ;
	    case e_total_reg_wait:
	        PRD ( pm*tct.total_reg_wait) ;
            case e_total_state_vwait: 
		PRD ( pm*tct.total_state_vwait ) ;
	    case e_total_state_vsuspend:
		PRD ( pm*tct.total_state_vsuspend ) ;
            case e_total_state_vsleep:
		PRD ( pm*tct.total_state_vsleep ) ;
 
	    default: 
		fprintf (fo,"Unknown Type %d\n" , ii ) ;
		exit (1) ;
	}
    }
    fprintf (fo,"\n") ;
}

static void PrintWizString ( i , v )
int	i ;
char	*v ;
{
    fprintf (fo,S[i].FDat , v ) ;
    if (R3)
	fprintf (fo," ") ;
}

static void PrintWizNumeric ( i , v )
int	i ;
double	v ;
{
    time_t  tt;
    char    ts [100] ;

    switch (S[i].DataType)
    {
	case Int :	   
	     fprintf (fo,S[i].FDat , (int) v ) ;
	     break ;
	case Float :	   
	     if ( v < 0.0 ) v = 0 ;
	     fprintf (fo,S[i].FDat , (double) v ) ;
	     break ;
	case Long :	   
	     fprintf (fo,S[i].FDat ,  (long) v ) ;
	     break ;
	case Double :	   
	     if ( v < 0.0 ) v = 0 ;
	     fprintf (fo,S[i].FDat ,  v ) ;
	     break ;
	case Time :
	     tt = (time_t) v ;
	     strcpy ( ts , ctime (&tt) ) ;
	     ts [19] = 0 ;
	     fprintf (fo,S[i].FDat , ts+11) ;
	     break ;
    }

    if (R3)
         fprintf (fo," ") ;
}

static void OpenOutputFile ( fn ) 
char	*fn ;
{
    char   fna [256] ;
    
    sprintf ( fna , "%s.wtc" , fn ) ;

    if ( ( fo = fopen ( fna , "w" ) ) == NULL )
    {
         perror ( "Error opening protocol file (datefile)");
         exit (1) ;
    }
}

static float  Percent ( v1 , v2 )
int     v1 , v2 ;
{
    if ( v2 == 0 )
        return 100.0 ;
    else
        return ( (float)((float) v1*100.0 / (float)v2));
}

static int Max100 (v)
{
	return ( v > 100 ? 100 : v ) ;
}

static void ErrEx ( s ) 
char	*s ;
{
	perror (s) ;
	exit (4) ;
}

static void usage()
{
	fprintf (fo,"Usage: x_wiztrc [-i fn] [-P ln] [-o|-c|-t|-O|-C|-g|-s|-S|-l|-r|-R|-T|-d|-p]\n") ;
	fprintf (fo,"	-i	read data from file <fn>. Default: x_wizard.bin\n") ;
	fprintf (fo,"	-P	new heading after each <ln> lines\n") ;
	fprintf (fo,"	-o	overview\n") ;
	fprintf (fo,"	-c	executed commands\n") ;
	fprintf (fo,"	-t	transactions\n") ;
	fprintf (fo,"	-O	I/O\n") ;
	fprintf (fo,"	-C	caches\n") ;
	fprintf (fo,"	-g	logging\n") ;
	fprintf (fo,"	-s	select strategy (1)\n") ;
	fprintf (fo,"	-S	select strategy (2)\n") ;
	fprintf (fo,"	-l	lock\n") ;
	fprintf (fo,"	-r	region accesses and collisions (1)\n") ;
	fprintf (fo,"	-R	region accesses and collisions (2)\n") ;
	fprintf (fo,"	-T	temp page activities\n") ;
	fprintf (fo,"	-d	dispatching\n") ;
	fprintf (fo,"	-p	prioritization\n") ;
}

.CM *-END-* code ----------------------------------------
.sp 2
***********************************************************
*-PRETTY-*  statements    :           0
*-PRETTY-*  lines of code :           0
*-PRETTY-*  lines in file :           0
.pa
