ktrace.h 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101
  1. /*
  2. * Copyright (c) 2000-2003 Silicon Graphics, Inc. All Rights Reserved.
  3. *
  4. * This program is free software; you can redistribute it and/or modify it
  5. * under the terms of version 2 of the GNU General Public License as
  6. * published by the Free Software Foundation.
  7. *
  8. * This program is distributed in the hope that it would be useful, but
  9. * WITHOUT ANY WARRANTY; without even the implied warranty of
  10. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  11. *
  12. * Further, this software is distributed without any warranty that it is
  13. * free of the rightful claim of any third person regarding infringement
  14. * or the like. Any license provided herein, whether implied or
  15. * otherwise, applies only to this software file. Patent licenses, if
  16. * any, provided herein do not apply to combinations of this program with
  17. * other software, or any other product whatsoever.
  18. *
  19. * You should have received a copy of the GNU General Public License along
  20. * with this program; if not, write the Free Software Foundation, Inc., 59
  21. * Temple Place - Suite 330, Boston MA 02111-1307, USA.
  22. *
  23. * Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy,
  24. * Mountain View, CA 94043, or:
  25. *
  26. * http://www.sgi.com
  27. *
  28. * For further information regarding this notice, see:
  29. *
  30. * http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/
  31. */
  32. #ifndef __XFS_SUPPORT_KTRACE_H__
  33. #define __XFS_SUPPORT_KTRACE_H__
  34. #include <spin.h>
  35. /*
  36. * Trace buffer entry structure.
  37. */
  38. typedef struct ktrace_entry {
  39. void *val[16];
  40. } ktrace_entry_t;
  41. /*
  42. * Trace buffer header structure.
  43. */
  44. typedef struct ktrace {
  45. lock_t kt_lock; /* mutex to guard counters */
  46. int kt_nentries; /* number of entries in trace buf */
  47. int kt_index; /* current index in entries */
  48. int kt_rollover;
  49. ktrace_entry_t *kt_entries; /* buffer of entries */
  50. } ktrace_t;
  51. /*
  52. * Trace buffer snapshot structure.
  53. */
  54. typedef struct ktrace_snap {
  55. int ks_start; /* kt_index at time of snap */
  56. int ks_index; /* current index */
  57. } ktrace_snap_t;
  58. #ifdef CONFIG_XFS_TRACE
  59. extern void ktrace_init(int zentries);
  60. extern void ktrace_uninit(void);
  61. extern ktrace_t *ktrace_alloc(int, int);
  62. extern void ktrace_free(ktrace_t *);
  63. extern void ktrace_enter(
  64. ktrace_t *,
  65. void *,
  66. void *,
  67. void *,
  68. void *,
  69. void *,
  70. void *,
  71. void *,
  72. void *,
  73. void *,
  74. void *,
  75. void *,
  76. void *,
  77. void *,
  78. void *,
  79. void *,
  80. void *);
  81. extern ktrace_entry_t *ktrace_first(ktrace_t *, ktrace_snap_t *);
  82. extern int ktrace_nentries(ktrace_t *);
  83. extern ktrace_entry_t *ktrace_next(ktrace_t *, ktrace_snap_t *);
  84. extern ktrace_entry_t *ktrace_skip(ktrace_t *, int, ktrace_snap_t *);
  85. #else
  86. #define ktrace_init(x) do { } while (0)
  87. #define ktrace_uninit() do { } while (0)
  88. #endif /* CONFIG_XFS_TRACE */
  89. #endif /* __XFS_SUPPORT_KTRACE_H__ */