simpletrace.h 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. /*
  2. * Simple trace backend
  3. *
  4. * Copyright IBM, Corp. 2010
  5. *
  6. * This work is licensed under the terms of the GNU GPL, version 2. See
  7. * the COPYING file in the top-level directory.
  8. *
  9. */
  10. #ifndef SIMPLETRACE_H
  11. #define SIMPLETRACE_H
  12. #include <stdint.h>
  13. #include <stdbool.h>
  14. #include <stdio.h>
  15. #ifdef CONFIG_SIMPLE_TRACE
  16. typedef uint64_t TraceEventID;
  17. typedef struct {
  18. const char *tp_name;
  19. bool state;
  20. } TraceEvent;
  21. void trace0(TraceEventID event);
  22. void trace1(TraceEventID event, uint64_t x1);
  23. void trace2(TraceEventID event, uint64_t x1, uint64_t x2);
  24. void trace3(TraceEventID event, uint64_t x1, uint64_t x2, uint64_t x3);
  25. void trace4(TraceEventID event, uint64_t x1, uint64_t x2, uint64_t x3, uint64_t x4);
  26. void trace5(TraceEventID event, uint64_t x1, uint64_t x2, uint64_t x3, uint64_t x4, uint64_t x5);
  27. void trace6(TraceEventID event, uint64_t x1, uint64_t x2, uint64_t x3, uint64_t x4, uint64_t x5, uint64_t x6);
  28. void st_print_trace(FILE *stream, fprintf_function stream_printf);
  29. void st_print_trace_events(FILE *stream, fprintf_function stream_printf);
  30. bool st_change_trace_event_state(const char *tname, bool tstate);
  31. void st_print_trace_file_status(FILE *stream, fprintf_function stream_printf);
  32. void st_set_trace_file_enabled(bool enable);
  33. bool st_set_trace_file(const char *file);
  34. void st_flush_trace_buffer(void);
  35. bool st_init(const char *file);
  36. #else
  37. static inline bool st_init(const char *file)
  38. {
  39. return true;
  40. }
  41. #endif /* !CONFIG_SIMPLE_TRACE */
  42. #endif /* SIMPLETRACE_H */