1 /* $NetBSD: trace.h,v 1.8 1997/01/22 07:09:27 mikel Exp $ */ 2 3 /*- 4 * Copyright (c) 1982, 1986, 1993 5 * The Regents of the University of California. All rights reserved. 6 * 7 * Redistribution and use in source and binary forms, with or without 8 * modification, are permitted provided that the following conditions 9 * are met: 10 * 1. Redistributions of source code must retain the above copyright 11 * notice, this list of conditions and the following disclaimer. 12 * 2. Redistributions in binary form must reproduce the above copyright 13 * notice, this list of conditions and the following disclaimer in the 14 * documentation and/or other materials provided with the distribution. 15 * 3. All advertising materials mentioning features or use of this software 16 * must display the following acknowledgement: 17 * This product includes software developed by the University of 18 * California, Berkeley and its contributors. 19 * 4. Neither the name of the University nor the names of its contributors 20 * may be used to endorse or promote products derived from this software 21 * without specific prior written permission. 22 * 23 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 24 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 25 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 26 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 27 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 28 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 29 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 30 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 31 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 32 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 33 * SUCH DAMAGE. 34 * 35 * @(#)trace.h 8.1 (Berkeley) 6/2/93 36 */ 37 38 #ifndef _SYS_TRACE_H_ 39 #define _SYS_TRACE_H_ 40 41 /* 42 * File system buffer tracing points; all trace <pack(dev, size), bn> 43 */ 44 #define TR_BREADHIT 0 /* buffer read found in cache */ 45 #define TR_BREADMISS 1 /* buffer read not in cache */ 46 #define TR_BWRITE 2 /* buffer written */ 47 #define TR_BREADHITRA 3 /* buffer read-ahead found in cache */ 48 #define TR_BREADMISSRA 4 /* buffer read-ahead not in cache */ 49 #define TR_XFODMISS 5 /* exe fod read */ 50 #define TR_XFODHIT 6 /* exe fod read */ 51 #define TR_BRELSE 7 /* brelse */ 52 #define TR_BREALLOC 8 /* expand/contract a buffer */ 53 54 /* 55 * Memory allocator trace points; all trace the amount of memory involved 56 */ 57 #define TR_MALL 10 /* memory allocated */ 58 59 /* 60 * Paging trace points: all are <vaddr, pid> 61 */ 62 #define TR_INTRANS 20 /* page intransit block */ 63 #define TR_EINTRANS 21 /* page intransit wait done */ 64 #define TR_FRECLAIM 22 /* reclaim from free list */ 65 #define TR_RECLAIM 23 /* reclaim from loop */ 66 #define TR_XSFREC 24 /* reclaim from free list instead of drum */ 67 #define TR_XIFREC 25 /* reclaim from free list instead of fsys */ 68 #define TR_WAITMEM 26 /* wait for memory in pagein */ 69 #define TR_EWAITMEM 27 /* end memory wait in pagein */ 70 #define TR_ZFOD 28 /* zfod page fault */ 71 #define TR_EXFOD 29 /* exec fod page fault */ 72 #define TR_VRFOD 30 /* vread fod page fault */ 73 #define TR_CACHEFOD 31 /* fod in file system cache */ 74 #define TR_SWAPIN 32 /* drum page fault */ 75 #define TR_PGINDONE 33 /* page in done */ 76 #define TR_SWAPIO 34 /* swap i/o request arrives */ 77 78 /* 79 * System call trace points. 80 */ 81 #define TR_VADVISE 40 /* vadvise occurred with <arg, pid> */ 82 83 /* 84 * Miscellaneous 85 */ 86 #define TR_STAMP 45 /* user said vtrace(VTR_STAMP, value); */ 87 88 /* 89 * This defines the size of the trace flags array. 90 */ 91 #define TR_NFLAGS 100 /* generous */ 92 93 #define TRCSIZ 4096 94 95 /* 96 * Specifications of the vtrace() system call, which takes one argument. 97 */ 98 #define VTRACE 64+51 99 100 #define VTR_DISABLE 0 /* set a trace flag to 0 */ 101 #define VTR_ENABLE 1 /* set a trace flag to 1 */ 102 #define VTR_VALUE 2 /* return value of a trace flag */ 103 #define VTR_UALARM 3 /* set alarm to go off (sig 16) */ 104 /* in specified number of hz */ 105 #define VTR_STAMP 4 /* user specified stamp */ 106 107 #ifdef _KERNEL 108 #ifdef TRACE 109 struct proc *traceproc; 110 int tracewhich, tracebuf[TRCSIZ]; 111 u_int tracex; 112 char traceflags[TR_NFLAGS]; 113 #define pack(v,b) (((v)->v_mount->mnt_stat.f_fsid.val[0])<<16)|(b) 114 #define trace(a,b,c) { \ 115 if (traceflags[a]) \ 116 trace1(a,b,c); \ 117 } 118 #else 119 #define trace(a,b,c) 120 #endif /* TRACE */ 121 #endif /* _KERNEL */ 122 123 #endif /* !_SYS_TRACE_H_ */ 124