xref: /csrg-svn/sys/netiso/tp_meas.c (revision 63222)
149268Sbostic /*-
2*63222Sbostic  * Copyright (c) 1991, 1993
3*63222Sbostic  *	The Regents of the University of California.  All rights reserved.
449268Sbostic  *
549268Sbostic  * %sccs.include.redist.c%
649268Sbostic  *
7*63222Sbostic  *	@(#)tp_meas.c	8.1 (Berkeley) 06/10/93
849268Sbostic  */
949268Sbostic 
1036404Ssklower /***********************************************************
1136404Ssklower 		Copyright IBM Corporation 1987
1236404Ssklower 
1336404Ssklower                       All Rights Reserved
1436404Ssklower 
1536404Ssklower Permission to use, copy, modify, and distribute this software and its
1636404Ssklower documentation for any purpose and without fee is hereby granted,
1736404Ssklower provided that the above copyright notice appear in all copies and that
1836404Ssklower both that copyright notice and this permission notice appear in
1936404Ssklower supporting documentation, and that the name of IBM not be
2036404Ssklower used in advertising or publicity pertaining to distribution of the
2136404Ssklower software without specific, written prior permission.
2236404Ssklower 
2336404Ssklower IBM DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
2436404Ssklower ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
2536404Ssklower IBM BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
2636404Ssklower ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
2736404Ssklower WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
2836404Ssklower ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
2936404Ssklower SOFTWARE.
3036404Ssklower 
3136404Ssklower ******************************************************************/
3236404Ssklower 
3336404Ssklower /*
3436404Ssklower  * ARGO Project, Computer Sciences Dept., University of Wisconsin - Madison
3536404Ssklower  */
3636404Ssklower /*
3736404Ssklower  * $Header: tp_meas.c,v 5.2 88/11/18 17:28:04 nhall Exp $
3836404Ssklower  * $Source: /usr/argo/sys/netiso/RCS/tp_meas.c,v $
3936404Ssklower  *
4036404Ssklower  * tp_meas.c : create a performance measurement event
4136404Ssklower  * in the circular buffer tp_Meas[]
4236404Ssklower  */
4336404Ssklower 
4456533Sbostic #include <sys/types.h>
4556533Sbostic #include <sys/time.h>
4636404Ssklower 
4756533Sbostic #include <netiso/argo_debug.h>
4856533Sbostic #include <netiso/tp_meas.h>
4956533Sbostic 
5036404Ssklower extern struct timeval time;
5136404Ssklower 
5236404Ssklower #ifdef TP_PERF_MEAS
5336404Ssklower int		tp_Measn = 0;
5436404Ssklower struct tp_Meas tp_Meas[TPMEASN];
5536404Ssklower 
5636404Ssklower /*
5736404Ssklower  * NAME:	 tpmeas()
5836404Ssklower  *
5936404Ssklower  * CALLED FROM: tp_emit(), tp_soisdisconecting(), tp_soisdisconnected()
6036404Ssklower  *	tp0_stash(), tp_stash(), tp_send(), tp_goodack(), tp_usrreq()
6136404Ssklower  *
6236404Ssklower  * FUNCTION and ARGUMENTS:
6336404Ssklower  *  stashes a performance-measurement event for the given reference (ref)
6436404Ssklower  *  (kind) tells which kind of event, timev is the time to be stored
6536404Ssklower  *  with this event, (seq), (win), and (size) are integers that usually
6636404Ssklower  *  refer to the sequence number, window number (on send) and
6736404Ssklower  *  size of tpdu or window.
6836404Ssklower  *
6936404Ssklower  * RETURNS:		Nada
7036404Ssklower  *
7136404Ssklower  * SIDE EFFECTS:
7236404Ssklower  *
7336404Ssklower  * NOTES:
7436404Ssklower  */
7536404Ssklower void
Tpmeas(ref,kind,timev,seq,win,size)7637469Ssklower Tpmeas(ref, kind, timev, seq, win, size)
7736404Ssklower 	u_int 	ref;
7836404Ssklower 	u_int	kind;
7936404Ssklower 	struct 	timeval *timev;
8036404Ssklower 	u_int	seq, win, size;
8136404Ssklower {
8236404Ssklower 	register struct tp_Meas *tpm;
8336404Ssklower 	static int mseq;
8436404Ssklower 
8536404Ssklower 	tpm = &tp_Meas[tp_Measn++];
8636404Ssklower 	tp_Measn %= TPMEASN;
8736404Ssklower 
8836404Ssklower 	tpm->tpm_kind = kind;
8936404Ssklower 	tpm->tpm_tseq = mseq++;
9036404Ssklower 	tpm->tpm_ref = ref;
9136404Ssklower 	if(kind == TPtime_from_ll)
9236404Ssklower 		bcopy((caddr_t)timev, (caddr_t)&tpm->tpm_time, sizeof(struct timeval));
9336404Ssklower 	else
9436404Ssklower 		bcopy( (caddr_t)&time,
9536404Ssklower 			(caddr_t)&tpm->tpm_time, sizeof(struct timeval) );
9636404Ssklower 	tpm->tpm_seq = seq;
9736404Ssklower 	tpm->tpm_window = win;
9836404Ssklower 	tpm->tpm_size = size;
9936404Ssklower }
10036404Ssklower 
10160359Sbostic #endif /* TP_PERF_MEAS */
102