File:  [Power 6/32 Unix Tahoe 4.2BSD] / cci / usr / src / usr.bin / bsc / cmd / 3270 / emstats.c
Revision 1.1.1.1 (vendor branch): download - view: text, annotated - select for diffs
Sun Jul 28 12:26:11 2019 UTC (7 years ago) by root
Branches: bsd, MAIN
CVS tags: v121, HEAD
Power 6/32 Unix version 1.21

/*	D.L.Buck and Associates, Inc. - May, 1984
 *
 *	COPYRIGHT NOTICE:
 *		Copyright c 1984 - An unpublished work by 
 *		D.L.Buck and Associates, Inc.
 *
 *	PROPRIETARY RIGHTS NOTICE:
 *		All rights reserved. This document and program contains
 *		proprietary information of D.L.Buck and Associates,Inc.
 *		of San Jose, California, U.S.A., embodying confidential
 *		information,  ideas, and expressions,  no part of which
 *		may be reproduced, or transmitted in any form or by any
 *		means,  electronic,  mechanical,  or otherwise, without
 *		the written permission of D.L.Buck and Associates, Inc.
 * NAME
 *	emstats
 *
 * SYNOPSIS
 *	emstats()
 *
 * DESCRIPTION
 *	This routine computes current statistics for this 327x session,
 *	and displays them on cmd_scr. Statistics include number of blocks
 *	sent and received, total elapsed time for this session, and average
 *	response time.
 */

#include <em.h>

extern int tb_ctr;
extern int rb_ctr;
extern long lrsp_tm;
extern long rsp_tm;
extern int rsp_ctr;
extern long trax_tm;
extern long ltrax_tm;
extern int trax_ctr;

static char sccsid[] = "@(#)emstats.c	1.6 ";

emstats(wr_aud)
int wr_aud;	/* 1=write stat msg to AUDIT; 0=don't write stat msg to AUDIT */
{
	char statline[100];
	long trsecs = 0L;
	long ttsecs = 0L;

	if (rsp_ctr) trsecs = rsp_tm/(long)rsp_ctr;
	if (trax_ctr) ttsecs = trax_tm/(long)trax_ctr;
	trsecs /= 6L;	/* Avg response, tenths of seconds */
	ttsecs /= 6L;	/* Avg transaction, tenths of seconds */
	lrsp_tm /= 6L;	/* Last response, tenths of seconds */
	ltrax_tm /= 6L;	/* Last transaction, tenths of seconds */

/* construct statistics string */
	sprintf(statline,
"AvgTR=%ld.%ld,TT=%ld.%ld;LastTR=%ld.%ld,TT=%ld.%ld;Blks:%d sent,%d Rcvd",
		trsecs/10,trsecs%10,ttsecs/10,ttsecs%10,
		lrsp_tm/10,lrsp_tm%10, ltrax_tm/10,ltrax_tm%10,
		tb_ctr, rb_ctr);

/* add strings to cmd_scr */
	wstandout(cmd_scr);
	wmove(cmd_scr,0,0);
	wclear(cmd_scr);
	mvwaddstr(cmd_scr,0,0,statline);
	wrefresh(cmd_scr);

/* write to audit */
	if (wr_aud)	{
		sprintf(statline,
		"Average response time: %ld.%ld seconds; average transaction time %ld.%ld seconds",
		trsecs/10, trsecs%10, ttsecs/10, ttsecs%10);
		write_aud("T",statline);
		sprintf(statline,
		"Total blocks received: %d; total blocks transmitted: %d",
		rb_ctr, tb_ctr);
		write_aud("T",statline);
	}
}

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.