Commit | Line | Data |
---|---|---|
7bcd1bb8 KB |
1 | /*- |
2 | * Copyright (c) 1991 The Regents of the University of California. | |
3 | * All rights reserved. | |
4 | * | |
5 | * %sccs.include.redist.c% | |
6 | * | |
7 | * @(#)tp_meas.c 7.4 (Berkeley) %G% | |
8 | */ | |
9 | ||
b08d03f0 KS |
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 | ||
b08d03f0 KS |
44 | #include "types.h" |
45 | #include "time.h" | |
a50e2bc0 KS |
46 | #include "argo_debug.h" |
47 | #include "tp_meas.h" | |
b08d03f0 KS |
48 | |
49 | extern struct timeval time; | |
50 | ||
51 | #ifdef TP_PERF_MEAS | |
52 | int tp_Measn = 0; | |
53 | struct tp_Meas tp_Meas[TPMEASN]; | |
54 | ||
55 | /* | |
56 | * NAME: tpmeas() | |
57 | * | |
58 | * CALLED FROM: tp_emit(), tp_soisdisconecting(), tp_soisdisconnected() | |
59 | * tp0_stash(), tp_stash(), tp_send(), tp_goodack(), tp_usrreq() | |
60 | * | |
61 | * FUNCTION and ARGUMENTS: | |
62 | * stashes a performance-measurement event for the given reference (ref) | |
63 | * (kind) tells which kind of event, timev is the time to be stored | |
64 | * with this event, (seq), (win), and (size) are integers that usually | |
65 | * refer to the sequence number, window number (on send) and | |
66 | * size of tpdu or window. | |
67 | * | |
68 | * RETURNS: Nada | |
69 | * | |
70 | * SIDE EFFECTS: | |
71 | * | |
72 | * NOTES: | |
73 | */ | |
74 | void | |
a50e2bc0 | 75 | Tpmeas(ref, kind, timev, seq, win, size) |
b08d03f0 KS |
76 | u_int ref; |
77 | u_int kind; | |
78 | struct timeval *timev; | |
79 | u_int seq, win, size; | |
80 | { | |
81 | register struct tp_Meas *tpm; | |
82 | static int mseq; | |
83 | ||
84 | tpm = &tp_Meas[tp_Measn++]; | |
85 | tp_Measn %= TPMEASN; | |
86 | ||
87 | tpm->tpm_kind = kind; | |
88 | tpm->tpm_tseq = mseq++; | |
89 | tpm->tpm_ref = ref; | |
90 | if(kind == TPtime_from_ll) | |
91 | bcopy((caddr_t)timev, (caddr_t)&tpm->tpm_time, sizeof(struct timeval)); | |
92 | else | |
93 | bcopy( (caddr_t)&time, | |
94 | (caddr_t)&tpm->tpm_time, sizeof(struct timeval) ); | |
95 | tpm->tpm_seq = seq; | |
96 | tpm->tpm_window = win; | |
97 | tpm->tpm_size = size; | |
98 | } | |
99 | ||
100 | #endif TP_PERF_MEAS |