trace.h 951 B

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. /*
  2. * Copyright 2014, Michael Ellerman, IBM Corp.
  3. * Licensed under GPLv2.
  4. */
  5. #ifndef _SELFTESTS_POWERPC_PMU_EBB_TRACE_H
  6. #define _SELFTESTS_POWERPC_PMU_EBB_TRACE_H
  7. #include "utils.h"
  8. #define TRACE_TYPE_REG 1
  9. #define TRACE_TYPE_COUNTER 2
  10. #define TRACE_TYPE_STRING 3
  11. #define TRACE_TYPE_INDENT 4
  12. #define TRACE_TYPE_OUTDENT 5
  13. struct trace_entry
  14. {
  15. u8 type;
  16. u8 length;
  17. u8 data[0];
  18. };
  19. struct trace_buffer
  20. {
  21. u64 size;
  22. bool overflow;
  23. void *tail;
  24. u8 data[0];
  25. };
  26. struct trace_buffer *trace_buffer_allocate(u64 size);
  27. int trace_log_reg(struct trace_buffer *tb, u64 reg, u64 value);
  28. int trace_log_counter(struct trace_buffer *tb, u64 value);
  29. int trace_log_string(struct trace_buffer *tb, char *str);
  30. int trace_log_indent(struct trace_buffer *tb);
  31. int trace_log_outdent(struct trace_buffer *tb);
  32. void trace_buffer_print(struct trace_buffer *tb);
  33. void trace_print_location(struct trace_buffer *tb);
  34. #endif /* _SELFTESTS_POWERPC_PMU_EBB_TRACE_H */