kbuffer.h 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. /*
  2. * Copyright (C) 2012 Red Hat Inc, Steven Rostedt <srostedt@redhat.com>
  3. *
  4. * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  5. * This program is free software; you can redistribute it and/or
  6. * modify it under the terms of the GNU Lesser General Public
  7. * License as published by the Free Software Foundation;
  8. * version 2.1 of the License (not later!)
  9. *
  10. * This program is distributed in the hope that it will be useful,
  11. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  13. * GNU Lesser General Public License for more details.
  14. *
  15. * You should have received a copy of the GNU Lesser General Public
  16. * License along with this program; if not, write to the Free Software
  17. * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
  18. *
  19. * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  20. */
  21. #ifndef _KBUFFER_H
  22. #define _KBUFFER_H
  23. #ifndef TS_SHIFT
  24. #define TS_SHIFT 27
  25. #endif
  26. enum kbuffer_endian {
  27. KBUFFER_ENDIAN_BIG,
  28. KBUFFER_ENDIAN_LITTLE,
  29. };
  30. enum kbuffer_long_size {
  31. KBUFFER_LSIZE_4,
  32. KBUFFER_LSIZE_8,
  33. };
  34. enum {
  35. KBUFFER_TYPE_PADDING = 29,
  36. KBUFFER_TYPE_TIME_EXTEND = 30,
  37. KBUFFER_TYPE_TIME_STAMP = 31,
  38. };
  39. struct kbuffer;
  40. struct kbuffer *kbuffer_alloc(enum kbuffer_long_size size, enum kbuffer_endian endian);
  41. void kbuffer_free(struct kbuffer *kbuf);
  42. int kbuffer_load_subbuffer(struct kbuffer *kbuf, void *subbuffer);
  43. void *kbuffer_read_event(struct kbuffer *kbuf, unsigned long long *ts);
  44. void *kbuffer_next_event(struct kbuffer *kbuf, unsigned long long *ts);
  45. unsigned long long kbuffer_timestamp(struct kbuffer *kbuf);
  46. void *kbuffer_translate_data(int swap, void *data, unsigned int *size);
  47. void *kbuffer_read_at_offset(struct kbuffer *kbuf, int offset, unsigned long long *ts);
  48. int kbuffer_curr_index(struct kbuffer *kbuf);
  49. int kbuffer_curr_offset(struct kbuffer *kbuf);
  50. int kbuffer_curr_size(struct kbuffer *kbuf);
  51. int kbuffer_event_size(struct kbuffer *kbuf);
  52. int kbuffer_missed_events(struct kbuffer *kbuf);
  53. int kbuffer_subbuffer_size(struct kbuffer *kbuf);
  54. void kbuffer_set_old_format(struct kbuffer *kbuf);
  55. int kbuffer_start_of_data(struct kbuffer *kbuf);
  56. #endif /* _K_BUFFER_H */