Purpose
This subcommand
call is a performance statistics operation that returns transaction
cache counters. It is used to determine the number of transactions
in the transaction cache.
Format
syscall_parmlist
opcode 250 STATOP_TRAN_CACHE
parms[0] offset to STAT_API
parms[1] offset to output buffer
parms[2] offset to system name (optional)
parms[3] 0
parms[4] 0
parms[5] 0
parms[6] 0
STAT_API
sa_eye char[4] "STAP"
sa_len int length of buffer that follows STAT_API
sa_ver int 1
sa_flags char[1] 0x00
SA_RESET 0x80 Reset statistics
sa_fill char[3] 0
sa_reserve int[4] 0
posix_time_high unsigned long high order 32 bits since epoch
posix_time_low unsigned long low order 32 bits since epoch
posix_useconds unsigned long microseconds
pad1 int
STAT_TRAN_CACHE
sttr_started_high unsigned long transactions started high 32 bits
sttr_started unsigned long transactions started
sttr_lookups_high unsigned long lookups on transaction high 32 bits
sttr_lookups unsigned long lookups on transaction
sttr_ec_merges_high unsigned long equivalence class merges high 32 bits
sttr_ec_merges unsigned long equivalence class merges
sttr_alloc_trans_high unsigned long allocated transactions high 32 bits
sttr_alloc_trans unsigned long allocated transactions
sttr_trans_act_high unsigned long transactions active high 32 bits
sttr_trans_act unsigned long transactions active
sttr_trans_pend_high unsigned long transactions pending high 32 bits
sttr_trans_pend unsigned long transactions pending
sttr_trans_comp_high unsigned long transactions completed high 32 bits
sttr_trans_comp unsigned long transactions completed
sttr_trans_free_high unsigned long free transactions high 32 bits
sttr_trans_free unsigned long free transactions
reserved char[60] reserved
systemname char[9]
Return_value 0 if request is successful, -1 if it is not successful
Return_code
EINTR zFS is shutting down
EINVAL Invalid parameter list
EMVSERR Internal error occurred
E2BIG Information too big for buffer supplied
Reason_code
0xEFnnxxxx See z/OS Distributed File Service Messages and Codes
Usage notes
- Reserved fields and undefined flags must be set to binary zeros.
Related services
- Statistics Vnode Cache Information
- Statistics Metadata Cache Information
Examples
#pragma linkage(BPX1PCT, OS)
extern void BPX1PCT(char *, int, int, char *, int *, int *, int *);
/* #include <stdlib.h> */
#include <stdio.h>
#define ZFSCALL_STATS 0x40000007
#define STATOP_TRAN_CACHE 250 /* Performance API queries */
#define u_long unsigned long
typedef struct syscall_parmlist_t
{
int opcode; /* Operation code to perform */
int parms[7]; /* Specific to type of operation, */
/* provides access to the parms */
/* parms[4]-parms[6] are currently unused*/
} syscall_parmlist;
typedef struct stat_tran_cache_t
{
unsigned long sttr_started_high;
unsigned long sttr_started;
unsigned long sttr_lookups_high;
unsigned long sttr_lookups;
unsigned long sttr_ec_merges_high;
unsigned long sttr_ec_merges;
unsigned long sttr_alloc_trans_high;
unsigned long sttr_alloc_trans;
unsigned long sttr_trans_act_high;
unsigned long sttr_trans_act;
unsigned long sttr_trans_pend_high;
unsigned long sttr_trans_pend;
unsigned long sttr_trans_comp_high;
unsigned long sttr_trans_comp;
unsigned long sttr_trans_free_high;
unsigned long sttr_trans_free;
char reserved[60];
} STAT_TRAN_CACHE;
/* reset timestamp */
typedef struct reset_time {
u_long posix_time_high; /* high order 32 bits since epoc */
u_long posix_time_low; /* low order 32 bits since epoch */
u_long posix_usecs; /* microseconds */
int pad1;
} RESET_TIME;
/*********************************************************************/
/* The following structure is the api query control block */
/* It is used for all api query commands */
/*********************************************************************/
typedef struct stat_api_t
{
#define SA_EYE "STAP"
char sa_eye[4]; /* 4 byte identifier must be */
int sa_len; /* length of the buffer to put data into*/
/* this buffer area follows this struct*/
int sa_ver; /* the version number currently always 1*/
#define SA_VER_INITIAL 0x01
char sa_flags; /* flags field must be x00 or x80, x80 means reset statistics*/
#define SA_RESET 0x80
char sa_fill[3]; /* spare bytes */
int sa_reserve[4]; /* Reserved */
struct reset_time reset_time_info;
} STAT_API;
struct parmstruct
{
syscall_parmlist myparms;
STAT_API myapi;
STAT_TRAN_CACHE mystats;
char systemname[9];
} myparmstruct;
int main(int argc, char **argv)
{
int bpxrv;
int bpxrc;
int bpxrs;
int i;
STAT_API *stapptr = &(myparmstruct.myapi);
STAT_TRAN_CACHE *sttcptr = &(myparmstruct.mystats);
char buf[33];
myparmstruct.myparms.opcode = STATOP_TRAN_CACHE;
myparmstruct.myparms.parms[0] = sizeof(syscall_parmlist);
myparmstruct.myparms.parms[1] = sizeof(syscall_parmlist) + sizeof(STAT_API);
myparmstruct.myparms.parms[2] = 0;
/* Only specify a non-zero offset for the next field (parms[2]) if */
/* you are running z/OS 1.7 and above, and */
/* you want to query the tran cache statistics of a different system than this one */
/* myparmstruct.myparms.parms[2] = sizeof(syscall_parmlist) + sizeof(STAT_API) + */
/* sizeof(STAT_TRAN_CACHE); */
myparmstruct.myparms.parms[3] = 0;
myparmstruct.myparms.parms[4] = 0;
myparmstruct.myparms.parms[5] = 0;
myparmstruct.myparms.parms[6] = 0;
memset(stapptr,0,sizeof(STAT_API));
memcpy(stapptr->sa_eye,SA_EYE,4);
stapptr->sa_ver=SA_VER_INITIAL;
stapptr->sa_len=(int) sizeof(STAT_TRAN_CACHE);
/* This next field should only be set if parms[2] is non-zero */
/* strcpy(myparmstruct.systemname,"DCEIMGVQ"); */
BPX1PCT("ZFS ",
ZFSCALL_STATS, /* Perf statistics operation */
sizeof(myparmstruct), /* Length of Argument */
(char *) &myparmstruct, /* Pointer to Argument */
&bpxrv, /* Pointer to Return_value */
&bpxrc, /* Pointer to Return_code */
&bpxrs); /* Pointer to Reason_code */
if( bpxrv < 0 )
{
printf("Error querying tran cache, BPXRV = %d BPXRC = %d BPXRS = %x\n",bpxrv,bpxrc,bpxrs);
return bpxrc;
}
else
{
printf("%52s\n","Transaction Cache Statistics");
printf("%52s\n","----------------------------");
printf("\n");
printf("Trans started: %8u Lookups on Tran: %8u EC Merges: %8u\n",
myparmstruct.mystats.sttr_started,
myparmstruct.mystats.sttr_lookups,
myparmstruct.mystats.sttr_ec_merges);
printf("Allocated Trans: %8u (Act= %7u, Pend= %7u,\n",
myparmstruct.mystats.sttr_alloc_trans,
myparmstruct.mystats.sttr_trans_act,
myparmstruct.mystats.sttr_trans_pend);
printf(" Comp= %7u, Free= %7u)\n",
myparmstruct.mystats.sttr_trans_comp,
myparmstruct.mystats.sttr_trans_free);
if (0==ctime_r((time_t *) &stapptr->reset_time_info.posix_time_low, buf))
{
printf("Could not get timestamp.\n");
}
else
{ /* Insert the microseconds into the displayable time value */
strncpy(&(buf[27]),&(buf[20]),6);
sprintf(&(buf[20]),"%06d",stapptr->reset_time_info.posix_usecs);
buf[26]=' ';
buf[19]='.';
printf("Last Reset Time: %s",buf);
}
}
return 0;
}