|
|
1.1 root 1: /* D.L.Buck and Associates, Inc. - May, 1984
2: *
3: * COPYRIGHT NOTICE:
4: * Copyright c 1984 - An unpublished work by
5: * D.L.Buck and Associates, Inc.
6: *
7: * PROPRIETARY RIGHTS NOTICE:
8: * All rights reserved. This document and program contains
9: * proprietary information of D.L.Buck and Associates,Inc.
10: * of San Jose, California, U.S.A., embodying confidential
11: * information, ideas, and expressions, no part of which
12: * may be reproduced, or transmitted in any form or by any
13: * means, electronic, mechanical, or otherwise, without
14: * the written permission of D.L.Buck and Associates, Inc.
15: * NAME
16: * emstats
17: *
18: * SYNOPSIS
19: * emstats()
20: *
21: * DESCRIPTION
22: * This routine computes current statistics for this 327x session,
23: * and displays them on cmd_scr. Statistics include number of blocks
24: * sent and received, total elapsed time for this session, and average
25: * response time.
26: */
27:
28: #include <em.h>
29:
30: extern int tb_ctr;
31: extern int rb_ctr;
32: extern long lrsp_tm;
33: extern long rsp_tm;
34: extern int rsp_ctr;
35: extern long trax_tm;
36: extern long ltrax_tm;
37: extern int trax_ctr;
38:
39: static char sccsid[] = "@(#)emstats.c 1.6 ";
40:
41: emstats(wr_aud)
42: int wr_aud; /* 1=write stat msg to AUDIT; 0=don't write stat msg to AUDIT */
43: {
44: char statline[100];
45: long trsecs = 0L;
46: long ttsecs = 0L;
47:
48: if (rsp_ctr) trsecs = rsp_tm/(long)rsp_ctr;
49: if (trax_ctr) ttsecs = trax_tm/(long)trax_ctr;
50: trsecs /= 6L; /* Avg response, tenths of seconds */
51: ttsecs /= 6L; /* Avg transaction, tenths of seconds */
52: lrsp_tm /= 6L; /* Last response, tenths of seconds */
53: ltrax_tm /= 6L; /* Last transaction, tenths of seconds */
54:
55: /* construct statistics string */
56: sprintf(statline,
57: "AvgTR=%ld.%ld,TT=%ld.%ld;LastTR=%ld.%ld,TT=%ld.%ld;Blks:%d sent,%d Rcvd",
58: trsecs/10,trsecs%10,ttsecs/10,ttsecs%10,
59: lrsp_tm/10,lrsp_tm%10, ltrax_tm/10,ltrax_tm%10,
60: tb_ctr, rb_ctr);
61:
62: /* add strings to cmd_scr */
63: wstandout(cmd_scr);
64: wmove(cmd_scr,0,0);
65: wclear(cmd_scr);
66: mvwaddstr(cmd_scr,0,0,statline);
67: wrefresh(cmd_scr);
68:
69: /* write to audit */
70: if (wr_aud) {
71: sprintf(statline,
72: "Average response time: %ld.%ld seconds; average transaction time %ld.%ld seconds",
73: trsecs/10, trsecs%10, ttsecs/10, ttsecs%10);
74: write_aud("T",statline);
75: sprintf(statline,
76: "Total blocks received: %d; total blocks transmitted: %d",
77: rb_ctr, tb_ctr);
78: write_aud("T",statline);
79: }
80: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.