xref: /original-bsd/sys/sys/trace.h (revision 03bd62d7)
1 /*-
2  * Copyright (c) 1982, 1986 The Regents of the University of California.
3  * All rights reserved.
4  *
5  * %sccs.include.redist.c%
6  *
7  *	@(#)trace.h	7.7 (Berkeley) 10/22/92
8  */
9 
10 /*
11  * File system buffer tracing points; all trace <pack(dev, size), bn>
12  */
13 #define	TR_BREADHIT	0	/* buffer read found in cache */
14 #define	TR_BREADMISS	1	/* buffer read not in cache */
15 #define	TR_BWRITE	2	/* buffer written */
16 #define	TR_BREADHITRA	3	/* buffer read-ahead found in cache */
17 #define	TR_BREADMISSRA	4	/* buffer read-ahead not in cache */
18 #define	TR_XFODMISS	5	/* exe fod read */
19 #define	TR_XFODHIT	6	/* exe fod read */
20 #define	TR_BRELSE	7	/* brelse */
21 #define	TR_BREALLOC	8	/* expand/contract a buffer */
22 
23 /*
24  * Memory allocator trace points; all trace the amount of memory involved
25  */
26 #define	TR_MALL		10	/* memory allocated */
27 
28 /*
29  * Paging trace points: all are <vaddr, pid>
30  */
31 #define	TR_INTRANS	20	/* page intransit block */
32 #define	TR_EINTRANS	21	/* page intransit wait done */
33 #define	TR_FRECLAIM	22	/* reclaim from free list */
34 #define	TR_RECLAIM	23	/* reclaim from loop */
35 #define	TR_XSFREC	24	/* reclaim from free list instead of drum */
36 #define	TR_XIFREC	25	/* reclaim from free list instead of fsys */
37 #define	TR_WAITMEM	26	/* wait for memory in pagein */
38 #define	TR_EWAITMEM	27	/* end memory wait in pagein */
39 #define	TR_ZFOD		28	/* zfod page fault */
40 #define	TR_EXFOD	29	/* exec fod page fault */
41 #define	TR_VRFOD	30	/* vread fod page fault */
42 #define	TR_CACHEFOD	31	/* fod in file system cache */
43 #define	TR_SWAPIN	32	/* drum page fault */
44 #define	TR_PGINDONE	33	/* page in done */
45 #define	TR_SWAPIO	34	/* swap i/o request arrives */
46 
47 /*
48  * System call trace points.
49  */
50 #define	TR_VADVISE	40	/* vadvise occurred with <arg, pid> */
51 
52 /*
53  * Miscellaneous
54  */
55 #define	TR_STAMP	45	/* user said vtrace(VTR_STAMP, value); */
56 
57 /*
58  * This defines the size of the trace flags array.
59  */
60 #define	TR_NFLAGS	100	/* generous */
61 
62 #define	TRCSIZ		4096
63 
64 /*
65  * Specifications of the vtrace() system call, which takes one argument.
66  */
67 #define	VTRACE		64+51
68 
69 #define	VTR_DISABLE	0		/* set a trace flag to 0 */
70 #define	VTR_ENABLE	1		/* set a trace flag to 1 */
71 #define	VTR_VALUE	2		/* return value of a trace flag */
72 #define	VTR_UALARM	3		/* set alarm to go off (sig 16) */
73 					/* in specified number of hz */
74 #define	VTR_STAMP	4		/* user specified stamp */
75 
76 #ifdef KERNEL
77 #ifdef TRACE
78 struct	proc *traceproc;
79 int	tracewhich, tracebuf[TRCSIZ];
80 u_int	tracex;
81 char	traceflags[TR_NFLAGS];
82 #define	pack(v,b)	(((v)->v_mount->mnt_stat.f_fsid.val[0])<<16)|(b)
83 #define	trace(a,b,c) {							\
84 	if (traceflags[a])						\
85 		trace1(a,b,c);						\
86 }
87 #else
88 #define	trace(a,b,c)
89 #endif
90 #endif
91