summaryrefslogtreecommitdiffstats
path: root/src/usr/trace/tracebuffer.H
diff options
context:
space:
mode:
authorPatrick Williams <iawillia@us.ibm.com>2011-04-08 12:25:37 -0500
committerPatrick Williams <iawillia@us.ibm.com>2011-04-08 12:25:37 -0500
commit770f2f7e5d826b11c6e65d929dcc44a203833abc (patch)
tree7b389798264f36fbc5b3e5bebc8e1a7fc9dc8ea0 /src/usr/trace/tracebuffer.H
parent7088cec37222610a2e45838550dc7bf30f0f8d81 (diff)
downloadtalos-hostboot-770f2f7e5d826b11c6e65d929dcc44a203833abc.tar.gz
talos-hostboot-770f2f7e5d826b11c6e65d929dcc44a203833abc.zip
Rename trace buffer to match coding conventions.
Diffstat (limited to 'src/usr/trace/tracebuffer.H')
-rw-r--r--src/usr/trace/tracebuffer.H51
1 files changed, 51 insertions, 0 deletions
diff --git a/src/usr/trace/tracebuffer.H b/src/usr/trace/tracebuffer.H
new file mode 100644
index 000000000..4ac416eac
--- /dev/null
+++ b/src/usr/trace/tracebuffer.H
@@ -0,0 +1,51 @@
+#ifndef __TRACE_TRACEBUFFER_H
+#define __TRACE_TRACEBUFFER_H
+
+#include <stdint.h>
+#include <stdlib.h>
+#include <new>
+#include <limits.h>
+#include <sys/task.h>
+
+struct traceEntry
+{
+ uint64_t component;
+ tid_t tid;
+ uint16_t length;
+ uint32_t hash;
+ uint64_t timestamp;
+ uint32_t line;
+ uint64_t values[0];
+};
+
+
+class TracePage
+{
+ public:
+ TracePage() : next(NULL), size(0) {};
+
+ TracePage* setNext(TracePage*);
+ TracePage* getNext() { return next; };
+ traceEntry* claimEntry(size_t size);
+
+ private:
+ TracePage* volatile next;
+ uint64_t size;
+};
+
+class TraceBuffer
+{
+ public:
+ TraceBuffer()
+ {
+ first = last = new (malloc(PAGE_SIZE)) TracePage();
+ }
+
+ traceEntry* claimEntry(size_t size);
+
+ private:
+ TracePage* first;
+ TracePage* volatile last;
+};
+
+#endif
OpenPOWER on IntegriCloud