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