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