| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1 | /* | 
| Nathan Scott | 7b71876 | 2005-11-02 14:58:39 +1100 | [diff] [blame] | 2 | * Copyright (c) 2000-2003,2005 Silicon Graphics, Inc. | 
|  | 3 | * All Rights Reserved. | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4 | * | 
| Nathan Scott | 7b71876 | 2005-11-02 14:58:39 +1100 | [diff] [blame] | 5 | * This program is free software; you can redistribute it and/or | 
|  | 6 | * modify it under the terms of the GNU General Public License as | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7 | * published by the Free Software Foundation. | 
|  | 8 | * | 
| Nathan Scott | 7b71876 | 2005-11-02 14:58:39 +1100 | [diff] [blame] | 9 | * This program is distributed in the hope that it would be useful, | 
|  | 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | 
|  | 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the | 
|  | 12 | * GNU General Public License for more details. | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 13 | * | 
| Nathan Scott | 7b71876 | 2005-11-02 14:58:39 +1100 | [diff] [blame] | 14 | * You should have received a copy of the GNU General Public License | 
|  | 15 | * along with this program; if not, write the Free Software Foundation, | 
|  | 16 | * Inc.,  51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 17 | */ | 
|  | 18 | #ifndef __XFS_SUPPORT_KTRACE_H__ | 
|  | 19 | #define __XFS_SUPPORT_KTRACE_H__ | 
|  | 20 |  | 
|  | 21 | #include <spin.h> | 
|  | 22 |  | 
|  | 23 | /* | 
|  | 24 | * Trace buffer entry structure. | 
|  | 25 | */ | 
|  | 26 | typedef struct ktrace_entry { | 
|  | 27 | void	*val[16]; | 
|  | 28 | } ktrace_entry_t; | 
|  | 29 |  | 
|  | 30 | /* | 
|  | 31 | * Trace buffer header structure. | 
|  | 32 | */ | 
|  | 33 | typedef struct ktrace { | 
|  | 34 | lock_t		kt_lock;	/* mutex to guard counters */ | 
|  | 35 | int		kt_nentries;	/* number of entries in trace buf */ | 
|  | 36 | int		kt_index;	/* current index in entries */ | 
|  | 37 | int		kt_rollover; | 
|  | 38 | ktrace_entry_t	*kt_entries;	/* buffer of entries */ | 
|  | 39 | } ktrace_t; | 
|  | 40 |  | 
|  | 41 | /* | 
|  | 42 | * Trace buffer snapshot structure. | 
|  | 43 | */ | 
|  | 44 | typedef struct ktrace_snap { | 
|  | 45 | int		ks_start;	/* kt_index at time of snap */ | 
|  | 46 | int		ks_index;	/* current index */ | 
|  | 47 | } ktrace_snap_t; | 
|  | 48 |  | 
|  | 49 |  | 
|  | 50 | #ifdef CONFIG_XFS_TRACE | 
|  | 51 |  | 
|  | 52 | extern void ktrace_init(int zentries); | 
|  | 53 | extern void ktrace_uninit(void); | 
|  | 54 |  | 
| Christoph Hellwig | 4750ddb | 2005-11-02 15:07:23 +1100 | [diff] [blame] | 55 | extern ktrace_t *ktrace_alloc(int, unsigned int __nocast); | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 56 | extern void ktrace_free(ktrace_t *); | 
|  | 57 |  | 
|  | 58 | extern void ktrace_enter( | 
|  | 59 | ktrace_t	*, | 
|  | 60 | void		*, | 
|  | 61 | void		*, | 
|  | 62 | void		*, | 
|  | 63 | void		*, | 
|  | 64 | void		*, | 
|  | 65 | void		*, | 
|  | 66 | void		*, | 
|  | 67 | void		*, | 
|  | 68 | void		*, | 
|  | 69 | void		*, | 
|  | 70 | void		*, | 
|  | 71 | void		*, | 
|  | 72 | void		*, | 
|  | 73 | void		*, | 
|  | 74 | void		*, | 
|  | 75 | void		*); | 
|  | 76 |  | 
|  | 77 | extern ktrace_entry_t   *ktrace_first(ktrace_t *, ktrace_snap_t *); | 
|  | 78 | extern int              ktrace_nentries(ktrace_t *); | 
|  | 79 | extern ktrace_entry_t   *ktrace_next(ktrace_t *, ktrace_snap_t *); | 
|  | 80 | extern ktrace_entry_t   *ktrace_skip(ktrace_t *, int, ktrace_snap_t *); | 
|  | 81 |  | 
|  | 82 | #else | 
|  | 83 | #define ktrace_init(x)	do { } while (0) | 
|  | 84 | #define ktrace_uninit()	do { } while (0) | 
|  | 85 | #endif	/* CONFIG_XFS_TRACE */ | 
|  | 86 |  | 
|  | 87 | #endif	/* __XFS_SUPPORT_KTRACE_H__ */ |