| 933 | |
| 934 | |
| 935 | static void prt_lock_activity(OUTFILE outfile, |
| 936 | const lhb* LOCK_header, |
| 937 | USHORT flag, |
| 938 | ULONG seconds, |
| 939 | ULONG intervals) |
| 940 | { |
| 941 | /************************************** |
| 942 | * |
| 943 | * p r t _ l o c k _ a c t i v i t y |
| 944 | * |
| 945 | ************************************** |
| 946 | * |
| 947 | * Functional description |
| 948 | * Print a time-series lock activity report |
| 949 | * |
| 950 | **************************************/ |
| 951 | time_t clock = time(NULL); |
| 952 | tm d = *localtime(&clock); |
| 953 | |
| 954 | FPRINTF(outfile, "%02d:%02d:%02d ", d.tm_hour, d.tm_min, d.tm_sec); |
| 955 | |
| 956 | if (flag & SW_I_ACQUIRE) |
| 957 | FPRINTF(outfile, "acquire/s acqwait/s %%acqwait acqrtry/s rtrysuc/s "); |
| 958 | |
| 959 | if (flag & SW_I_OPERATION) |
| 960 | FPRINTF(outfile, "enqueue/s convert/s downgrd/s dequeue/s readata/s wrtdata/s qrydata/s "); |
| 961 | |
| 962 | if (flag & SW_I_TYPE) |
| 963 | FPRINTF(outfile, " dblop/s rellop/s pagelop/s tranlop/s relxlop/s idxxlop/s misclop/s "); |
| 964 | |
| 965 | if (flag & SW_I_WAIT) |
| 966 | FPRINTF(outfile, " wait/s reject/s timeout/s blckast/s wakeup/s dlkscan/s deadlck/s "); |
| 967 | |
| 968 | FPRINTF(outfile, "\n"); |
| 969 | |
| 970 | lhb base = *LOCK_header; |
| 971 | lhb prior = *LOCK_header; |
| 972 | |
| 973 | if (intervals == 0) |
| 974 | { |
| 975 | memset(&base, 0, sizeof(base)); |
| 976 | } |
| 977 | |
| 978 | for (ULONG i = 0; i < intervals; i++) |
| 979 | { |
| 980 | fflush(outfile); |
| 981 | |
| 982 | bool empty = false; |
| 983 | for (ULONG ss = 0; ss < seconds; ss++) |
| 984 | { |
| 985 | empty = SRQ_EMPTY(LOCK_header->lhb_processes); |
| 986 | if (empty) |
| 987 | break; |
| 988 | |
| 989 | #ifdef WIN_NT |
| 990 | Sleep(1000); |
| 991 | #else |
| 992 | sleep(1); |
no test coverage detected