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