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