2 ****************************************************************************
3 * Copyright IBM Corporation 1988, 1989 - All Rights Reserved *
5 * Permission to use, copy, modify, and distribute this software and its *
6 * documentation for any purpose and without fee is hereby granted, *
7 * provided that the above copyright notice appear in all copies and *
8 * that both that copyright notice and this permission notice appear in *
9 * supporting documentation, and that the name of IBM not be used in *
10 * advertising or publicity pertaining to distribution of the software *
11 * without specific, written prior permission. *
13 * IBM DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL *
14 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL IBM *
15 * BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY *
16 * DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER *
17 * IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING *
18 * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. *
19 ****************************************************************************
27 char rxi_tracename
[80] = "/tmp/rxcalltrace";
30 char rxi_tracename
[80] = "\0Change This pathname (and preceding NUL) to initiate tracing";
37 char rxi_tracebuf
[4096];
38 unsigned long rxi_tracepos
= 0;
40 struct rx_trace rxtinfo
;
45 write(rxi_logfd
, rxi_tracebuf
, rxi_tracepos
);
50 rxi_calltrace(unsigned int event
, struct rx_call
*call
)
54 if (!rxi_tracename
[0])
58 rxi_logfd
= open(rxi_tracename
, O_WRONLY
| O_CREAT
| O_TRUNC
, 0777);
60 rxi_tracename
[0] = '\0';
64 rxtinfo
.event
= event
;
65 rxtinfo
.now
= now
.sec
* 1000 + now
.usec
/ 1000;
66 rxtinfo
.cid
= call
->conn
->cid
;
67 rxtinfo
.call
= *(call
->callNumber
);
68 rxtinfo
.qlen
= rx_nWaiting
;
69 rxtinfo
.servicetime
= 0;
74 clock_Sub(&now
, &(call
->traceStart
));
75 rxtinfo
.servicetime
= now
.sec
* 10000 + now
.usec
/ 100;
76 if (call
->traceWait
.sec
) {
77 now
= call
->traceStart
;
78 clock_Sub(&now
, &(call
->traceWait
));
79 rxtinfo
.waittime
= now
.sec
* 10000 + now
.usec
/ 100;
82 call
->traceWait
.sec
= call
->traceWait
.usec
=
83 call
->traceStart
.sec
= call
->traceStart
.usec
= 0;
87 call
->traceStart
= now
;
88 if (call
->traceWait
.sec
) {
89 clock_Sub(&now
, &(call
->traceWait
));
90 rxtinfo
.waittime
= now
.sec
* 10000 + now
.usec
/ 100;
96 if (call
->traceWait
.sec
) {
97 clock_Sub(&now
, &(call
->traceWait
));
98 rxtinfo
.waittime
= now
.sec
* 10000 + now
.usec
/ 100;
100 rxtinfo
.waittime
= 0;
103 case RX_CALL_ARRIVAL
:
104 call
->traceWait
= now
;
109 memcpy(rxi_tracebuf
+ rxi_tracepos
, &rxtinfo
, sizeof(struct rx_trace
));
110 rxi_tracepos
+= sizeof(struct rx_trace
);
111 if (rxi_tracepos
>= (4096 - sizeof(struct rx_trace
)))