xref: /csrg-svn/sys/netiso/tp_meas.c (revision 38841)
1 /***********************************************************
2 		Copyright IBM Corporation 1987
3 
4                       All Rights Reserved
5 
6 Permission to use, copy, modify, and distribute this software and its
7 documentation for any purpose and without fee is hereby granted,
8 provided that the above copyright notice appear in all copies and that
9 both that copyright notice and this permission notice appear in
10 supporting documentation, and that the name of IBM not be
11 used in advertising or publicity pertaining to distribution of the
12 software without specific, written prior permission.
13 
14 IBM DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
15 ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
16 IBM BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
17 ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
18 WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
19 ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
20 SOFTWARE.
21 
22 ******************************************************************/
23 
24 /*
25  * ARGO Project, Computer Sciences Dept., University of Wisconsin - Madison
26  */
27 /*
28  * $Header: tp_meas.c,v 5.2 88/11/18 17:28:04 nhall Exp $
29  * $Source: /usr/argo/sys/netiso/RCS/tp_meas.c,v $
30  *	@(#)tp_meas.c	7.3 (Berkeley) 08/29/89 *
31  *
32  * tp_meas.c : create a performance measurement event
33  * in the circular buffer tp_Meas[]
34  */
35 
36 #ifndef lint
37 static char *rcsid = "$Header: tp_meas.c,v 5.2 88/11/18 17:28:04 nhall Exp $";
38 #endif lint
39 
40 #include "types.h"
41 #include "time.h"
42 #include "argo_debug.h"
43 #include "tp_meas.h"
44 
45 extern struct timeval time;
46 
47 #ifdef TP_PERF_MEAS
48 int		tp_Measn = 0;
49 struct tp_Meas tp_Meas[TPMEASN];
50 
51 /*
52  * NAME:	 tpmeas()
53  *
54  * CALLED FROM: tp_emit(), tp_soisdisconecting(), tp_soisdisconnected()
55  *	tp0_stash(), tp_stash(), tp_send(), tp_goodack(), tp_usrreq()
56  *
57  * FUNCTION and ARGUMENTS:
58  *  stashes a performance-measurement event for the given reference (ref)
59  *  (kind) tells which kind of event, timev is the time to be stored
60  *  with this event, (seq), (win), and (size) are integers that usually
61  *  refer to the sequence number, window number (on send) and
62  *  size of tpdu or window.
63  *
64  * RETURNS:		Nada
65  *
66  * SIDE EFFECTS:
67  *
68  * NOTES:
69  */
70 void
71 Tpmeas(ref, kind, timev, seq, win, size)
72 	u_int 	ref;
73 	u_int	kind;
74 	struct 	timeval *timev;
75 	u_int	seq, win, size;
76 {
77 	register struct tp_Meas *tpm;
78 	static int mseq;
79 
80 	tpm = &tp_Meas[tp_Measn++];
81 	tp_Measn %= TPMEASN;
82 
83 	tpm->tpm_kind = kind;
84 	tpm->tpm_tseq = mseq++;
85 	tpm->tpm_ref = ref;
86 	if(kind == TPtime_from_ll)
87 		bcopy((caddr_t)timev, (caddr_t)&tpm->tpm_time, sizeof(struct timeval));
88 	else
89 		bcopy( (caddr_t)&time,
90 			(caddr_t)&tpm->tpm_time, sizeof(struct timeval) );
91 	tpm->tpm_seq = seq;
92 	tpm->tpm_window = win;
93 	tpm->tpm_size = size;
94 }
95 
96 #endif TP_PERF_MEAS
97