[PATCH] CTF few event added

Ravindra Meena rmeena840 at gmail.com
Wed Jun 19 13:02:26 UTC 2019


---
 misc/CTF/record-ctf.ref |  73 ------------------------
 misc/ctf/metadata       | 145 ++++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 145 insertions(+), 73 deletions(-)
 delete mode 100644 misc/CTF/record-ctf.ref
 create mode 100644 misc/ctf/metadata

diff --git a/misc/CTF/record-ctf.ref b/misc/CTF/record-ctf.ref
deleted file mode 100644
index bdb9648..0000000
--- a/misc/CTF/record-ctf.ref
+++ /dev/null
@@ -1,73 +0,0 @@
-/* CTF 1.8 */
-
-/*
- * typealias
- *
- * The "typealias" declaration can be used to give a name to a type. 
- * Typealias is a superset of "typedef": it also allows assignment of a
- * simple variable identifier to a type.
- */
- 
-typealias integer { size = 8; align = 8; signed = false; } := uint8_t;
-typealias integer { size = 16; align = 8; signed = false; } := uint16_t;
-typealias integer { size = 32; align = 8; signed = false; } := uint32_t;
-typealias integer { size = 64; align = 8; signed = false; } := uint64_t;
-typealias integer { size = 5; align = 1; signed = false; } := uint5_t;
-typealias integer { size = 27; align = 1; signed = false; } := uint27_t;
-
-trace {
-    major = 1; /* CTF spec version major number */
-    minor = 8; /* CTF spec version minor number */
-    byte_order = le; /* little endian byte-order */
-    packet.header := struct {
-        uint32_t magic; /* specifies that this is a CTF packet */
-        uint32_t stream_id; /* used as reference to stream description in metadata */
-    };
-};
-
-clock {
-    name = ctf_clock; /* name of montonic clock */
-    freq = 1000; /* frequency, in HZ */
-    offset_s = 1421703448; 
-};
-
-/*
- *  A reference to the clock added within an integer type 
- */
-
-typealias integer {
-    size = 64;
-    map = clock.ctf_clock.value;
-} := ctf_clock_int_t;
-
-/*
- * Trace stream packet having header and context.
- *
- * @param event.header includes id(unique identifier of stream) and timestamp.
- * @param packet.context includes clock timestamp, cpu id, event and event data. 
- */
-
-stream {
-    id = 0;
-    event.header := struct {
-        uint32_t id;
-        ctf_clock_int_t timestamp;
-    };
-    packet.context := struct {
-		ctf_clock_int_t timestamp;
-		uint32_t cpu;
-		uint32_t event;
-		uint64_t data;
-    };
-};
-
-event {
-    id = 0; /* event id
-    name = "ctf_event"; /* event name */
-    stream_id = 0; /* signifies stream id which event is supposed to concat with events */
-    fields := struct {
-        uint32_t a; /*event 1*/
-        uint16_t b; /*event 2*/
-        string c; /*event 3*/
-    };
-};
diff --git a/misc/ctf/metadata b/misc/ctf/metadata
new file mode 100644
index 0000000..0e7dca4
--- /dev/null
+++ b/misc/ctf/metadata
@@ -0,0 +1,145 @@
+/* CTF 1.8 */
+
+/*
+ * typealias
+ *
+ * The "typealias" declaration can be used to give a name to a type. 
+ * Typealias is a superset of "typedef": it also allows assignment of a
+ * simple variable identifier to a type.
+ */
+ 
+typealias integer { size = 8; align = 8; signed = false; } := uint8_t;
+typealias integer { size = 16; align = 8; signed = false; } := uint16_t;
+typealias integer { size = 32; align = 8; signed = false; } := uint32_t;
+typealias integer { size = 64; align = 8; signed = false; } := uint64_t;
+typealias integer { size = 5; align = 1; signed = false; } := uint5_t;
+typealias integer { size = 27; align = 1; signed = false; } := uint27_t;
+
+trace {
+    major = 1; /* CTF spec version major number */
+    minor = 8; /* CTF spec version minor number */
+    byte_order = le; /* little endian byte-order */
+    packet.header := struct {
+        uint32_t magic; /* specifies that this is a CTF packet */
+        uint8_t  uuid[16]; /* Unique Universal Identifier, ensure the event
+                              packet match the metadata used */
+        uint32_t stream_id; /* used as reference to stream description in
+                               metadata */
+    };
+};
+
+clock {
+    name = "monotonic"; /* name of montonic clock */
+    description = "Monotonic Clock";
+    freq = 1000; /* frequency, in HZ */
+};
+
+/*
+ *  A reference to the clock added within an unsigned integer type 
+ */
+
+typealias integer {
+    size = 64; align = 8; signed = false;
+    map = clock.monotonic.value;
+} := uint64_clock_monotonic_t;
+
+typealias integer {
+	size = 32; align = 8; signed = false;
+	map = clock.monotonic.value;
+} := uint32_clock_monotonic_t;
+
+typealias integer {
+	size = 27; align = 1; signed = false;
+	map = clock.monotonic.value;
+} := uint27_clock_monotonic_t;
+
+/*
+ * packet.context containing timestamp, cpu, event, data; 
+ */
+
+struct packet_context {
+    uint64_clock_monotonic_t timestamp;
+	uint32_t cpu;
+	uint32_t event;
+	uint64_t data;
+};
+
+/*
+ * event.header type for few event IDS
+ */
+
+struct event_header_compact {
+	enum : uint5_t { compact = 0 ... 30, extended = 31 } id;
+	variant <id> {
+		struct {
+			uint27_clock_monotonic_t timestamp;
+		} compact;
+		struct {
+			uint32_t id;
+			uint64_clock_monotonic_t timestamp;
+		} extended;
+	} v;
+} align(8);
+
+/*
+ * event.header type for many event IDS
+ */
+
+struct event_header_large {
+	enum : uint16_t { compact = 0 ... 65534, extended = 65535 } id;
+	variant <id> {
+		struct {
+			uint32_clock_monotonic_t timestamp;
+		} compact;
+		struct {
+			uint32_t id;
+			uint64_clock_monotonic_t timestamp;
+		} extended;
+	} v;
+} align(8);
+
+/*
+ * stream containing header and context.
+ */
+
+stream {
+	id = 0;
+	event.header := struct event_header_compact; /* sturct defined above */
+	packet.context := struct packet_context; /* sturct defined above */
+};
+
+/*
+ * event recording events
+ */
+
+event {
+	name = "EMPTY";
+	id = 0;
+	stream_id = 0;
+	fields := struct {
+        integer {
+			size = 32;
+			align = 8;
+			signed = false;
+			byte_order = le;
+			base = 10;
+			encoding = none;
+		} my_field;
+	};
+};
+
+event {
+	name = "VERSION";
+	id = 1;
+	stream_id = 0;
+	fields := struct {
+        integer {
+			size = 32;
+			align = 8;
+			signed = false;
+			byte_order = le;
+			base = 10;
+			encoding = none;
+		} my_field;
+	};
+};
-- 
2.7.4



More information about the devel mailing list