Merge "Enable kgsl ftrace event capture" into main
diff --git a/protos/perfetto/trace/ftrace/ftrace_event.proto b/protos/perfetto/trace/ftrace/ftrace_event.proto
index 6d9334e..4a0a589 100644
--- a/protos/perfetto/trace/ftrace/ftrace_event.proto
+++ b/protos/perfetto/trace/ftrace/ftrace_event.proto
@@ -670,5 +670,9 @@
     MaliMaliPMMCUPOWERDOWNFtraceEvent mali_mali_PM_MCU_POWER_DOWN = 531;
     MaliMaliPMMCURESETWAITFtraceEvent mali_mali_PM_MCU_RESET_WAIT = 532;
     BclIrqTriggerFtraceEvent bcl_irq_trigger = 533;
+    KgslAdrenoCmdbatchQueuedFtraceEvent kgsl_adreno_cmdbatch_queued = 534;
+    KgslAdrenoCmdbatchSubmittedFtraceEvent kgsl_adreno_cmdbatch_submitted = 535;
+    KgslAdrenoCmdbatchSyncFtraceEvent kgsl_adreno_cmdbatch_sync = 536;
+    KgslAdrenoCmdbatchRetiredFtraceEvent kgsl_adreno_cmdbatch_retired = 537;
   }
 }
diff --git a/protos/perfetto/trace/ftrace/kgsl.proto b/protos/perfetto/trace/ftrace/kgsl.proto
index dcb03ca..80dc6a6 100644
--- a/protos/perfetto/trace/ftrace/kgsl.proto
+++ b/protos/perfetto/trace/ftrace/kgsl.proto
@@ -9,3 +9,50 @@
   optional uint32 gpu_freq = 1;
   optional uint32 gpu_id = 2;
 }
+message KgslAdrenoCmdbatchQueuedFtraceEvent {
+  optional uint32 id = 1;
+  optional uint32 timestamp = 2;
+  optional uint32 queued = 3;
+  optional uint32 flags = 4;
+  optional uint32 prio = 5;
+}
+message KgslAdrenoCmdbatchSubmittedFtraceEvent {
+  optional uint32 id = 1;
+  optional uint32 timestamp = 2;
+  optional int64 inflight = 3;
+  optional uint32 flags = 4;
+  optional uint64 ticks = 5;
+  optional uint64 secs = 6;
+  optional uint64 usecs = 7;
+  optional int32 prio = 8;
+  optional int32 rb_id = 9;
+  optional uint32 rptr = 10;
+  optional uint32 wptr = 11;
+  optional int32 q_inflight = 12;
+  optional int32 dispatch_queue = 13;
+}
+message KgslAdrenoCmdbatchSyncFtraceEvent {
+  optional uint32 id = 1;
+  optional uint32 timestamp = 2;
+  optional uint64 ticks = 3;
+  optional int32 prio = 4;
+}
+message KgslAdrenoCmdbatchRetiredFtraceEvent {
+  optional uint32 id = 1;
+  optional uint32 timestamp = 2;
+  optional int64 inflight = 3;
+  optional uint32 recovery = 4;
+  optional uint32 flags = 5;
+  optional uint64 start = 6;
+  optional uint64 retire = 7;
+  optional int32 prio = 8;
+  optional int32 rb_id = 9;
+  optional uint32 rptr = 10;
+  optional uint32 wptr = 11;
+  optional int32 q_inflight = 12;
+  optional uint64 fault_recovery = 13;
+  optional uint32 dispatch_queue = 14;
+  optional uint64 submitted_to_rb = 15;
+  optional uint64 retired_on_gmu = 16;
+  optional uint64 active = 17;
+}
diff --git a/protos/perfetto/trace/perfetto_trace.proto b/protos/perfetto/trace/perfetto_trace.proto
index ad902e8..339ed95 100644
--- a/protos/perfetto/trace/perfetto_trace.proto
+++ b/protos/perfetto/trace/perfetto_trace.proto
@@ -8744,6 +8744,53 @@
   optional uint32 gpu_freq = 1;
   optional uint32 gpu_id = 2;
 }
+message KgslAdrenoCmdbatchQueuedFtraceEvent {
+  optional uint32 id = 1;
+  optional uint32 timestamp = 2;
+  optional uint32 queued = 3;
+  optional uint32 flags = 4;
+  optional uint32 prio = 5;
+}
+message KgslAdrenoCmdbatchSubmittedFtraceEvent {
+  optional uint32 id = 1;
+  optional uint32 timestamp = 2;
+  optional int64 inflight = 3;
+  optional uint32 flags = 4;
+  optional uint64 ticks = 5;
+  optional uint64 secs = 6;
+  optional uint64 usecs = 7;
+  optional int32 prio = 8;
+  optional int32 rb_id = 9;
+  optional uint32 rptr = 10;
+  optional uint32 wptr = 11;
+  optional int32 q_inflight = 12;
+  optional int32 dispatch_queue = 13;
+}
+message KgslAdrenoCmdbatchSyncFtraceEvent {
+  optional uint32 id = 1;
+  optional uint32 timestamp = 2;
+  optional uint64 ticks = 3;
+  optional int32 prio = 4;
+}
+message KgslAdrenoCmdbatchRetiredFtraceEvent {
+  optional uint32 id = 1;
+  optional uint32 timestamp = 2;
+  optional int64 inflight = 3;
+  optional uint32 recovery = 4;
+  optional uint32 flags = 5;
+  optional uint64 start = 6;
+  optional uint64 retire = 7;
+  optional int32 prio = 8;
+  optional int32 rb_id = 9;
+  optional uint32 rptr = 10;
+  optional uint32 wptr = 11;
+  optional int32 q_inflight = 12;
+  optional uint64 fault_recovery = 13;
+  optional uint32 dispatch_queue = 14;
+  optional uint64 submitted_to_rb = 15;
+  optional uint64 retired_on_gmu = 16;
+  optional uint64 active = 17;
+}
 
 // End of protos/perfetto/trace/ftrace/kgsl.proto
 
@@ -11029,6 +11076,10 @@
     MaliMaliPMMCUPOWERDOWNFtraceEvent mali_mali_PM_MCU_POWER_DOWN = 531;
     MaliMaliPMMCURESETWAITFtraceEvent mali_mali_PM_MCU_RESET_WAIT = 532;
     BclIrqTriggerFtraceEvent bcl_irq_trigger = 533;
+    KgslAdrenoCmdbatchQueuedFtraceEvent kgsl_adreno_cmdbatch_queued = 534;
+    KgslAdrenoCmdbatchSubmittedFtraceEvent kgsl_adreno_cmdbatch_submitted = 535;
+    KgslAdrenoCmdbatchSyncFtraceEvent kgsl_adreno_cmdbatch_sync = 536;
+    KgslAdrenoCmdbatchRetiredFtraceEvent kgsl_adreno_cmdbatch_retired = 537;
   }
 }
 
diff --git a/src/tools/ftrace_proto_gen/event_list b/src/tools/ftrace_proto_gen/event_list
index 8d1463c..9d5553d 100644
--- a/src/tools/ftrace_proto_gen/event_list
+++ b/src/tools/ftrace_proto_gen/event_list
@@ -528,3 +528,7 @@
 mali/mali_PM_MCU_POWER_DOWN
 mali/mali_PM_MCU_RESET_WAIT
 bcl_exynos/bcl_irq_trigger
+kgsl/adreno_cmdbatch_queued
+kgsl/adreno_cmdbatch_submitted
+kgsl/adreno_cmdbatch_sync
+kgsl/adreno_cmdbatch_retired
\ No newline at end of file
diff --git a/src/tools/ftrace_proto_gen/ftrace_proto_gen.cc b/src/tools/ftrace_proto_gen/ftrace_proto_gen.cc
index 36e8726..a036016 100644
--- a/src/tools/ftrace_proto_gen/ftrace_proto_gen.cc
+++ b/src/tools/ftrace_proto_gen/ftrace_proto_gen.cc
@@ -59,8 +59,7 @@
   // These groups have events where the name alone conflicts with an existing
   // proto:
   if (group == "sde" || group == "g2d" || group == "dpu" || group == "mali" ||
-      group == "lwis" || group == "samsung" ||
-      (group == "kgsl" && name == "gpu_frequency")) {
+      group == "lwis" || group == "samsung" || group == "kgsl") {
     event_name = group + "_" + event_name;
   }
   return event_name;
diff --git a/src/trace_processor/importers/ftrace/ftrace_descriptors.cc b/src/trace_processor/importers/ftrace/ftrace_descriptors.cc
index 3fd5e92..4e346e1 100644
--- a/src/trace_processor/importers/ftrace/ftrace_descriptors.cc
+++ b/src/trace_processor/importers/ftrace/ftrace_descriptors.cc
@@ -24,7 +24,7 @@
 namespace trace_processor {
 namespace {
 
-std::array<FtraceMessageDescriptor, 534> descriptors{{
+std::array<FtraceMessageDescriptor, 538> descriptors{{
     {nullptr, 0, {}},
     {nullptr, 0, {}},
     {nullptr, 0, {}},
@@ -5868,7 +5868,7 @@
         },
     },
     {
-        "bcl_exynos_bcl_irq_trigger",
+        "bcl_irq_trigger",
         9,
         {
             {},
@@ -5883,6 +5883,73 @@
             {"capacity", ProtoSchemaType::kInt32},
         },
     },
+    {
+        "kgsl_adreno_cmdbatch_queued",
+        5,
+        {
+            {},
+            {"id", ProtoSchemaType::kUint32},
+            {"timestamp", ProtoSchemaType::kUint32},
+            {"queued", ProtoSchemaType::kUint32},
+            {"flags", ProtoSchemaType::kUint32},
+            {"prio", ProtoSchemaType::kUint32},
+        },
+    },
+    {
+        "kgsl_adreno_cmdbatch_submitted",
+        13,
+        {
+            {},
+            {"id", ProtoSchemaType::kUint32},
+            {"timestamp", ProtoSchemaType::kUint32},
+            {"inflight", ProtoSchemaType::kInt64},
+            {"flags", ProtoSchemaType::kUint32},
+            {"ticks", ProtoSchemaType::kUint64},
+            {"secs", ProtoSchemaType::kUint64},
+            {"usecs", ProtoSchemaType::kUint64},
+            {"prio", ProtoSchemaType::kInt32},
+            {"rb_id", ProtoSchemaType::kInt32},
+            {"rptr", ProtoSchemaType::kUint32},
+            {"wptr", ProtoSchemaType::kUint32},
+            {"q_inflight", ProtoSchemaType::kInt32},
+            {"dispatch_queue", ProtoSchemaType::kInt32},
+        },
+    },
+    {
+        "kgsl_adreno_cmdbatch_sync",
+        4,
+        {
+            {},
+            {"id", ProtoSchemaType::kUint32},
+            {"timestamp", ProtoSchemaType::kUint32},
+            {"ticks", ProtoSchemaType::kUint64},
+            {"prio", ProtoSchemaType::kInt32},
+        },
+    },
+    {
+        "kgsl_adreno_cmdbatch_retired",
+        17,
+        {
+            {},
+            {"id", ProtoSchemaType::kUint32},
+            {"timestamp", ProtoSchemaType::kUint32},
+            {"inflight", ProtoSchemaType::kInt64},
+            {"recovery", ProtoSchemaType::kUint32},
+            {"flags", ProtoSchemaType::kUint32},
+            {"start", ProtoSchemaType::kUint64},
+            {"retire", ProtoSchemaType::kUint64},
+            {"prio", ProtoSchemaType::kInt32},
+            {"rb_id", ProtoSchemaType::kInt32},
+            {"rptr", ProtoSchemaType::kUint32},
+            {"wptr", ProtoSchemaType::kUint32},
+            {"q_inflight", ProtoSchemaType::kInt32},
+            {"fault_recovery", ProtoSchemaType::kUint64},
+            {"dispatch_queue", ProtoSchemaType::kUint32},
+            {"submitted_to_rb", ProtoSchemaType::kUint64},
+            {"retired_on_gmu", ProtoSchemaType::kUint64},
+            {"active", ProtoSchemaType::kUint64},
+        },
+    },
 }};
 
 }  // namespace
diff --git a/src/traced/probes/ftrace/event_info.cc b/src/traced/probes/ftrace/event_info.cc
index 7a5d793..4bc6a0c 100644
--- a/src/traced/probes/ftrace/event_info.cc
+++ b/src/traced/probes/ftrace/event_info.cc
@@ -5523,6 +5523,151 @@
        kUnsetFtraceId,
        509,
        kUnsetSize},
+      {"adreno_cmdbatch_queued",
+       "kgsl",
+       {
+           {kUnsetOffset, kUnsetSize, FtraceFieldType::kInvalidFtraceFieldType,
+            "id", 1, ProtoSchemaType::kUint32,
+            TranslationStrategy::kInvalidTranslationStrategy},
+           {kUnsetOffset, kUnsetSize, FtraceFieldType::kInvalidFtraceFieldType,
+            "timestamp", 2, ProtoSchemaType::kUint32,
+            TranslationStrategy::kInvalidTranslationStrategy},
+           {kUnsetOffset, kUnsetSize, FtraceFieldType::kInvalidFtraceFieldType,
+            "queued", 3, ProtoSchemaType::kUint32,
+            TranslationStrategy::kInvalidTranslationStrategy},
+           {kUnsetOffset, kUnsetSize, FtraceFieldType::kInvalidFtraceFieldType,
+            "flags", 4, ProtoSchemaType::kUint32,
+            TranslationStrategy::kInvalidTranslationStrategy},
+           {kUnsetOffset, kUnsetSize, FtraceFieldType::kInvalidFtraceFieldType,
+            "prio", 5, ProtoSchemaType::kUint32,
+            TranslationStrategy::kInvalidTranslationStrategy},
+       },
+       kUnsetFtraceId,
+       534,
+       kUnsetSize},
+      {"adreno_cmdbatch_submitted",
+       "kgsl",
+       {
+           {kUnsetOffset, kUnsetSize, FtraceFieldType::kInvalidFtraceFieldType,
+            "id", 1, ProtoSchemaType::kUint32,
+            TranslationStrategy::kInvalidTranslationStrategy},
+           {kUnsetOffset, kUnsetSize, FtraceFieldType::kInvalidFtraceFieldType,
+            "timestamp", 2, ProtoSchemaType::kUint32,
+            TranslationStrategy::kInvalidTranslationStrategy},
+           {kUnsetOffset, kUnsetSize, FtraceFieldType::kInvalidFtraceFieldType,
+            "inflight", 3, ProtoSchemaType::kInt64,
+            TranslationStrategy::kInvalidTranslationStrategy},
+           {kUnsetOffset, kUnsetSize, FtraceFieldType::kInvalidFtraceFieldType,
+            "flags", 4, ProtoSchemaType::kUint32,
+            TranslationStrategy::kInvalidTranslationStrategy},
+           {kUnsetOffset, kUnsetSize, FtraceFieldType::kInvalidFtraceFieldType,
+            "ticks", 5, ProtoSchemaType::kUint64,
+            TranslationStrategy::kInvalidTranslationStrategy},
+           {kUnsetOffset, kUnsetSize, FtraceFieldType::kInvalidFtraceFieldType,
+            "secs", 6, ProtoSchemaType::kUint64,
+            TranslationStrategy::kInvalidTranslationStrategy},
+           {kUnsetOffset, kUnsetSize, FtraceFieldType::kInvalidFtraceFieldType,
+            "usecs", 7, ProtoSchemaType::kUint64,
+            TranslationStrategy::kInvalidTranslationStrategy},
+           {kUnsetOffset, kUnsetSize, FtraceFieldType::kInvalidFtraceFieldType,
+            "prio", 8, ProtoSchemaType::kInt32,
+            TranslationStrategy::kInvalidTranslationStrategy},
+           {kUnsetOffset, kUnsetSize, FtraceFieldType::kInvalidFtraceFieldType,
+            "rb_id", 9, ProtoSchemaType::kInt32,
+            TranslationStrategy::kInvalidTranslationStrategy},
+           {kUnsetOffset, kUnsetSize, FtraceFieldType::kInvalidFtraceFieldType,
+            "rptr", 10, ProtoSchemaType::kUint32,
+            TranslationStrategy::kInvalidTranslationStrategy},
+           {kUnsetOffset, kUnsetSize, FtraceFieldType::kInvalidFtraceFieldType,
+            "wptr", 11, ProtoSchemaType::kUint32,
+            TranslationStrategy::kInvalidTranslationStrategy},
+           {kUnsetOffset, kUnsetSize, FtraceFieldType::kInvalidFtraceFieldType,
+            "q_inflight", 12, ProtoSchemaType::kInt32,
+            TranslationStrategy::kInvalidTranslationStrategy},
+           {kUnsetOffset, kUnsetSize, FtraceFieldType::kInvalidFtraceFieldType,
+            "dispatch_queue", 13, ProtoSchemaType::kInt32,
+            TranslationStrategy::kInvalidTranslationStrategy},
+       },
+       kUnsetFtraceId,
+       535,
+       kUnsetSize},
+      {"adreno_cmdbatch_sync",
+       "kgsl",
+       {
+           {kUnsetOffset, kUnsetSize, FtraceFieldType::kInvalidFtraceFieldType,
+            "id", 1, ProtoSchemaType::kUint32,
+            TranslationStrategy::kInvalidTranslationStrategy},
+           {kUnsetOffset, kUnsetSize, FtraceFieldType::kInvalidFtraceFieldType,
+            "timestamp", 2, ProtoSchemaType::kUint32,
+            TranslationStrategy::kInvalidTranslationStrategy},
+           {kUnsetOffset, kUnsetSize, FtraceFieldType::kInvalidFtraceFieldType,
+            "ticks", 3, ProtoSchemaType::kUint64,
+            TranslationStrategy::kInvalidTranslationStrategy},
+           {kUnsetOffset, kUnsetSize, FtraceFieldType::kInvalidFtraceFieldType,
+            "prio", 4, ProtoSchemaType::kInt32,
+            TranslationStrategy::kInvalidTranslationStrategy},
+       },
+       kUnsetFtraceId,
+       536,
+       kUnsetSize},
+      {"adreno_cmdbatch_retired",
+       "kgsl",
+       {
+           {kUnsetOffset, kUnsetSize, FtraceFieldType::kInvalidFtraceFieldType,
+            "id", 1, ProtoSchemaType::kUint32,
+            TranslationStrategy::kInvalidTranslationStrategy},
+           {kUnsetOffset, kUnsetSize, FtraceFieldType::kInvalidFtraceFieldType,
+            "timestamp", 2, ProtoSchemaType::kUint32,
+            TranslationStrategy::kInvalidTranslationStrategy},
+           {kUnsetOffset, kUnsetSize, FtraceFieldType::kInvalidFtraceFieldType,
+            "inflight", 3, ProtoSchemaType::kInt64,
+            TranslationStrategy::kInvalidTranslationStrategy},
+           {kUnsetOffset, kUnsetSize, FtraceFieldType::kInvalidFtraceFieldType,
+            "recovery", 4, ProtoSchemaType::kUint32,
+            TranslationStrategy::kInvalidTranslationStrategy},
+           {kUnsetOffset, kUnsetSize, FtraceFieldType::kInvalidFtraceFieldType,
+            "flags", 5, ProtoSchemaType::kUint32,
+            TranslationStrategy::kInvalidTranslationStrategy},
+           {kUnsetOffset, kUnsetSize, FtraceFieldType::kInvalidFtraceFieldType,
+            "start", 6, ProtoSchemaType::kUint64,
+            TranslationStrategy::kInvalidTranslationStrategy},
+           {kUnsetOffset, kUnsetSize, FtraceFieldType::kInvalidFtraceFieldType,
+            "retire", 7, ProtoSchemaType::kUint64,
+            TranslationStrategy::kInvalidTranslationStrategy},
+           {kUnsetOffset, kUnsetSize, FtraceFieldType::kInvalidFtraceFieldType,
+            "prio", 8, ProtoSchemaType::kInt32,
+            TranslationStrategy::kInvalidTranslationStrategy},
+           {kUnsetOffset, kUnsetSize, FtraceFieldType::kInvalidFtraceFieldType,
+            "rb_id", 9, ProtoSchemaType::kInt32,
+            TranslationStrategy::kInvalidTranslationStrategy},
+           {kUnsetOffset, kUnsetSize, FtraceFieldType::kInvalidFtraceFieldType,
+            "rptr", 10, ProtoSchemaType::kUint32,
+            TranslationStrategy::kInvalidTranslationStrategy},
+           {kUnsetOffset, kUnsetSize, FtraceFieldType::kInvalidFtraceFieldType,
+            "wptr", 11, ProtoSchemaType::kUint32,
+            TranslationStrategy::kInvalidTranslationStrategy},
+           {kUnsetOffset, kUnsetSize, FtraceFieldType::kInvalidFtraceFieldType,
+            "q_inflight", 12, ProtoSchemaType::kInt32,
+            TranslationStrategy::kInvalidTranslationStrategy},
+           {kUnsetOffset, kUnsetSize, FtraceFieldType::kInvalidFtraceFieldType,
+            "fault_recovery", 13, ProtoSchemaType::kUint64,
+            TranslationStrategy::kInvalidTranslationStrategy},
+           {kUnsetOffset, kUnsetSize, FtraceFieldType::kInvalidFtraceFieldType,
+            "dispatch_queue", 14, ProtoSchemaType::kUint32,
+            TranslationStrategy::kInvalidTranslationStrategy},
+           {kUnsetOffset, kUnsetSize, FtraceFieldType::kInvalidFtraceFieldType,
+            "submitted_to_rb", 15, ProtoSchemaType::kUint64,
+            TranslationStrategy::kInvalidTranslationStrategy},
+           {kUnsetOffset, kUnsetSize, FtraceFieldType::kInvalidFtraceFieldType,
+            "retired_on_gmu", 16, ProtoSchemaType::kUint64,
+            TranslationStrategy::kInvalidTranslationStrategy},
+           {kUnsetOffset, kUnsetSize, FtraceFieldType::kInvalidFtraceFieldType,
+            "active", 17, ProtoSchemaType::kUint64,
+            TranslationStrategy::kInvalidTranslationStrategy},
+       },
+       kUnsetFtraceId,
+       537,
+       kUnsetSize},
       {"alloc_pages_iommu_end",
        "kmem",
        {
diff --git a/src/traced/probes/ftrace/test/data/synthetic/events/kgsl/adreno_cmdbatch_queued/format b/src/traced/probes/ftrace/test/data/synthetic/events/kgsl/adreno_cmdbatch_queued/format
new file mode 100644
index 0000000..244840d
--- /dev/null
+++ b/src/traced/probes/ftrace/test/data/synthetic/events/kgsl/adreno_cmdbatch_queued/format
@@ -0,0 +1,15 @@
+name: adreno_cmdbatch_queued
+ID: 1203
+format:
+	field:unsigned short common_type;	offset:0;	size:2;	signed:0;
+	field:unsigned char common_flags;	offset:2;	size:1;	signed:0;
+	field:unsigned char common_preempt_count;	offset:3;	size:1;	signed:0;
+	field:int common_pid;	offset:4;	size:4;	signed:1;
+
+	field:unsigned int id;	offset:8;	size:4;	signed:0;
+	field:unsigned int timestamp;	offset:12;	size:4;	signed:0;
+	field:unsigned int queued;	offset:16;	size:4;	signed:0;
+	field:unsigned int flags;	offset:20;	size:4;	signed:0;
+	field:unsigned int prio;	offset:24;	size:4;	signed:0;
+
+print fmt: "ctx=%u ctx_prio=%u ts=%u queued=%u flags=%s", REC->id, REC->prio, REC->timestamp, REC->queued, REC->flags ? __print_flags(REC->flags, "|", { 0x00000002, "MARKER" }, { 0x00000008, "CTX_SWITCH" }, { 0x00000400, "SYNC" }, { 0x00000100, "EOF" }, { 0x00000800, "PWR_CONSTRAINT" }, { 0x00000004, "IB_LIST" }) : "none"
diff --git a/src/traced/probes/ftrace/test/data/synthetic/events/kgsl/adreno_cmdbatch_retired/format b/src/traced/probes/ftrace/test/data/synthetic/events/kgsl/adreno_cmdbatch_retired/format
new file mode 100644
index 0000000..e48f15d
--- /dev/null
+++ b/src/traced/probes/ftrace/test/data/synthetic/events/kgsl/adreno_cmdbatch_retired/format
@@ -0,0 +1,27 @@
+name: adreno_cmdbatch_retired
+ID: 1206
+format:
+	field:unsigned short common_type;	offset:0;	size:2;	signed:0;
+	field:unsigned char common_flags;	offset:2;	size:1;	signed:0;
+	field:unsigned char common_preempt_count;	offset:3;	size:1;	signed:0;
+	field:int common_pid;	offset:4;	size:4;	signed:1;
+
+	field:unsigned int id;	offset:8;	size:4;	signed:0;
+	field:unsigned int timestamp;	offset:12;	size:4;	signed:0;
+	field:int inflight;	offset:16;	size:4;	signed:1;
+	field:unsigned int recovery;	offset:20;	size:4;	signed:0;
+	field:unsigned int flags;	offset:24;	size:4;	signed:0;
+	field:uint64_t start;	offset:32;	size:8;	signed:0;
+	field:uint64_t retire;	offset:40;	size:8;	signed:0;
+	field:int prio;	offset:48;	size:4;	signed:1;
+	field:int rb_id;	offset:52;	size:4;	signed:1;
+	field:unsigned int rptr;	offset:56;	size:4;	signed:0;
+	field:unsigned int wptr;	offset:60;	size:4;	signed:0;
+	field:int q_inflight;	offset:64;	size:4;	signed:1;
+	field:unsigned long fault_recovery;	offset:72;	size:8;	signed:0;
+	field:unsigned int dispatch_queue;	offset:80;	size:4;	signed:0;
+	field:uint64_t submitted_to_rb;	offset:88;	size:8;	signed:0;
+	field:uint64_t retired_on_gmu;	offset:96;	size:8;	signed:0;
+	field:uint64_t active;	offset:104;	size:8;	signed:0;
+
+print fmt: "ctx=%u ctx_prio=%d ts=%u inflight=%d recovery=%s flags=%s start=%llu retire=%llu rb_id=%d, r/w=%x/%x, q_inflight=%d, dq_id=%u, submitted_to_rb=%llu retired_on_gmu=%llu active=%llu", REC->id, REC->prio, REC->timestamp, REC->inflight, REC->recovery ? __print_flags(REC->fault_recovery, "|", { ((((1UL))) << (KGSL_FT_OFF)), "off" }, { ((((1UL))) << (KGSL_FT_REPLAY)), "replay" }, { ((((1UL))) << (KGSL_FT_SKIPIB)), "skipib" }, { ((((1UL))) << (KGSL_FT_SKIPFRAME)), "skipframe" }, { ((((1UL))) << (KGSL_FT_DISABLE)), "disable" }, { ((((1UL))) << (KGSL_FT_TEMP_DISABLE)), "temp" }, { ((((1UL))) << (KGSL_FT_THROTTLE)), "throttle"}, { ((((1UL))) << (KGSL_FT_SKIPCMD)), "skipcmd" }) : "none", REC->flags ? __print_flags(REC->flags, "|", { 0x00000002, "MARKER" }, { 0x00000008, "CTX_SWITCH" }, { 0x00000400, "SYNC" }, { 0x00000100, "EOF" }, { 0x00000800, "PWR_CONSTRAINT" }, { 0x00000004, "IB_LIST" }) : "none", REC->start, REC->retire, REC->rb_id, REC->rptr, REC->wptr, REC->q_inflight, REC->dispatch_queue, REC->submitted_to_rb, REC->retired_on_gmu, REC->active
diff --git a/src/traced/probes/ftrace/test/data/synthetic/events/kgsl/adreno_cmdbatch_submitted/format b/src/traced/probes/ftrace/test/data/synthetic/events/kgsl/adreno_cmdbatch_submitted/format
new file mode 100644
index 0000000..471ea56
--- /dev/null
+++ b/src/traced/probes/ftrace/test/data/synthetic/events/kgsl/adreno_cmdbatch_submitted/format
@@ -0,0 +1,23 @@
+name: adreno_cmdbatch_submitted
+ID: 1207
+format:
+	field:unsigned short common_type;	offset:0;	size:2;	signed:0;
+	field:unsigned char common_flags;	offset:2;	size:1;	signed:0;
+	field:unsigned char common_preempt_count;	offset:3;	size:1;	signed:0;
+	field:int common_pid;	offset:4;	size:4;	signed:1;
+
+	field:unsigned int id;	offset:8;	size:4;	signed:0;
+	field:unsigned int timestamp;	offset:12;	size:4;	signed:0;
+	field:int inflight;	offset:16;	size:4;	signed:1;
+	field:unsigned int flags;	offset:20;	size:4;	signed:0;
+	field:uint64_t ticks;	offset:24;	size:8;	signed:0;
+	field:unsigned long secs;	offset:32;	size:8;	signed:0;
+	field:unsigned long usecs;	offset:40;	size:8;	signed:0;
+	field:int prio;	offset:48;	size:4;	signed:1;
+	field:int rb_id;	offset:52;	size:4;	signed:1;
+	field:unsigned int rptr;	offset:56;	size:4;	signed:0;
+	field:unsigned int wptr;	offset:60;	size:4;	signed:0;
+	field:int q_inflight;	offset:64;	size:4;	signed:1;
+	field:int dispatch_queue;	offset:68;	size:4;	signed:1;
+
+print fmt: "ctx=%u ctx_prio=%d ts=%u inflight=%d flags=%s ticks=%lld time=%lu.%0lu rb_id=%d r/w=%x/%x, q_inflight=%d dq_id=%d", REC->id, REC->prio, REC->timestamp, REC->inflight, REC->flags ? __print_flags(REC->flags, "|", { 0x00000002, "MARKER" }, { 0x00000008, "CTX_SWITCH" }, { 0x00000400, "SYNC" }, { 0x00000100, "EOF" }, { 0x00000800, "PWR_CONSTRAINT" }, { 0x00000004, "IB_LIST" }) : "none", REC->ticks, REC->secs, REC->usecs, REC->rb_id, REC->rptr, REC->wptr, REC->q_inflight, REC->dispatch_queue
diff --git a/src/traced/probes/ftrace/test/data/synthetic/events/kgsl/adreno_cmdbatch_sync/format b/src/traced/probes/ftrace/test/data/synthetic/events/kgsl/adreno_cmdbatch_sync/format
new file mode 100644
index 0000000..a6bb25a
--- /dev/null
+++ b/src/traced/probes/ftrace/test/data/synthetic/events/kgsl/adreno_cmdbatch_sync/format
@@ -0,0 +1,14 @@
+name: adreno_cmdbatch_sync
+ID: 1208
+format:
+	field:unsigned short common_type;	offset:0;	size:2;	signed:0;
+	field:unsigned char common_flags;	offset:2;	size:1;	signed:0;
+	field:unsigned char common_preempt_count;	offset:3;	size:1;	signed:0;
+	field:int common_pid;	offset:4;	size:4;	signed:1;
+
+	field:unsigned int id;	offset:8;	size:4;	signed:0;
+	field:unsigned int timestamp;	offset:12;	size:4;	signed:0;
+	field:uint64_t ticks;	offset:16;	size:8;	signed:0;
+	field:int prio;	offset:24;	size:4;	signed:1;
+
+print fmt: "ctx=%u ctx_prio=%d ts=%u ticks=%lld", REC->id, REC->prio, REC->timestamp, REC->ticks