xref: /original-bsd/sys/netiso/tp_meas.c (revision 440fde76)
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  *
31  * tp_meas.c : create a performance measurement event
32  * in the circular buffer tp_Meas[]
33  */
34 
35 #ifndef lint
36 static char *rcsid = "$Header: tp_meas.c,v 5.2 88/11/18 17:28:04 nhall Exp $";
37 #endif lint
38 
39 #include "types.h"
40 #include "time.h"
41 #include "argo_debug.h"
42 #include "tp_meas.h"
43 
44 extern struct timeval time;
45 
46 #ifdef TP_PERF_MEAS
47 int		tp_Measn = 0;
48 struct tp_Meas tp_Meas[TPMEASN];
49 
50 /*
51  * NAME:	 tpmeas()
52  *
53  * CALLED FROM: tp_emit(), tp_soisdisconecting(), tp_soisdisconnected()
54  *	tp0_stash(), tp_stash(), tp_send(), tp_goodack(), tp_usrreq()
55  *
56  * FUNCTION and ARGUMENTS:
57  *  stashes a performance-measurement event for the given reference (ref)
58  *  (kind) tells which kind of event, timev is the time to be stored
59  *  with this event, (seq), (win), and (size) are integers that usually
60  *  refer to the sequence number, window number (on send) and
61  *  size of tpdu or window.
62  *
63  * RETURNS:		Nada
64  *
65  * SIDE EFFECTS:
66  *
67  * NOTES:
68  */
69 void
70 Tpmeas(ref, kind, timev, seq, win, size)
71 	u_int 	ref;
72 	u_int	kind;
73 	struct 	timeval *timev;
74 	u_int	seq, win, size;
75 {
76 	register struct tp_Meas *tpm;
77 	static int mseq;
78 
79 	tpm = &tp_Meas[tp_Measn++];
80 	tp_Measn %= TPMEASN;
81 
82 	tpm->tpm_kind = kind;
83 	tpm->tpm_tseq = mseq++;
84 	tpm->tpm_ref = ref;
85 	if(kind == TPtime_from_ll)
86 		bcopy((caddr_t)timev, (caddr_t)&tpm->tpm_time, sizeof(struct timeval));
87 	else
88 		bcopy( (caddr_t)&time,
89 			(caddr_t)&tpm->tpm_time, sizeof(struct timeval) );
90 	tpm->tpm_seq = seq;
91 	tpm->tpm_window = win;
92 	tpm->tpm_size = size;
93 }
94 
95 #endif TP_PERF_MEAS
96