cpu_buffer.h 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. /**
  2. * @file cpu_buffer.h
  3. *
  4. * @remark Copyright 2002-2009 OProfile authors
  5. * @remark Read the file COPYING
  6. *
  7. * @author John Levon <levon@movementarian.org>
  8. * @author Robert Richter <robert.richter@amd.com>
  9. */
  10. int alloc_cpu_buffers(void);
  11. void free_cpu_buffers(void);
  12. void start_cpu_work(void);
  13. void end_cpu_work(void);
  14. void flush_cpu_work(void);
  15. struct op_entry;
  16. struct oprofile_cpu_buffer {
  17. Lock lock;
  18. unsigned long buffer_size;
  19. Proc *last_proc;
  20. int last_is_kernel;
  21. int tracing;
  22. unsigned long sample_received;
  23. unsigned long sample_lost_overflow;
  24. unsigned long backtrace_aborted;
  25. unsigned long sample_invalid_eip;
  26. int cpu;
  27. Block *block;
  28. /* long term plan: when we fill the block,
  29. * we write it to fullblock, and pull a
  30. * freeblock from the emptyblock queue.
  31. * The thread that pulls fullbocks and
  32. * allocates emptyblocks is timer-driven.
  33. * Or, barret will make me use his queues,
  34. * which is also fine; I just find the queue
  35. * functions convenient because they interface to
  36. * the dev code so easily.
  37. */
  38. Queue *fullqueue, *emptyqueue;
  39. };
  40. /* extra data flags */
  41. #define KERNEL_CTX_SWITCH (1UL << 0)
  42. #define IS_KERNEL (1UL << 1)
  43. #define TRACE_BEGIN (1UL << 2)
  44. #define USER_CTX_SWITCH (1UL << 3)