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