diff mbox

[13/15] tools: tracing: handle tasklets events in xentrace and xenalyze

Message ID 149633850903.12814.13022904151874996238.stgit@Solace.fritz.box (mailing list archive)
State New, archived
Headers show

Commit Message

Dario Faggioli June 1, 2017, 5:35 p.m. UTC
Signed-off-by: Dario Faggioli <dario.faggioli@citrix.com>
---
Cc: George Dunlap <george.dunlap@eu.citrix.com>
Cc: Ian Jackson <ian.jackson@eu.citrix.com>
Cc: Wei Liu <wei.liu2@citrix.com>
---
 tools/xentrace/formats    |    7 +++
 tools/xentrace/xenalyze.c |   92 +++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 99 insertions(+)
diff mbox

Patch

diff --git a/tools/xentrace/formats b/tools/xentrace/formats
index 615ba7d..7d59db7 100644
--- a/tools/xentrace/formats
+++ b/tools/xentrace/formats
@@ -219,6 +219,13 @@ 
 0x01002003  CPU%(cpu)d  %(tsc)d (+%(reltsc)8d)  softirq_raise_cpu [ nr:cpu = 0x%(1)08x ]
 0x01002004  CPU%(cpu)d  %(tsc)d (+%(reltsc)8d)  softirq_raise [ nr = %(1)d ]
 
+0x01004001  CPU%(cpu)d  %(tsc)d (+%(reltsc)8d)  tasklet_enqueue [ fn = 0x%(2)08x%(1)08x ]
+0x01004002  CPU%(cpu)d  %(tsc)d (+%(reltsc)8d)  tasklet_schedule [ fn = 0x%(2)08x%(1)08x, is_sirq:sched_on = 0x%(3)08x ]
+0x01004003  CPU%(cpu)d  %(tsc)d (+%(reltsc)8d)  tasklet_work [ fn = 0x%(2)08x%(1)08x ]
+0x01004004  CPU%(cpu)d  %(tsc)d (+%(reltsc)8d)  tasklet_kill [ fn = 0x%(2)08x%(1)08x, is_run:sched_on = 0x%(3)08x ]
+0x01004005  CPU%(cpu)d  %(tsc)d (+%(reltsc)8d)  tasklet_init [ fn = 0x%(2)08x%(1)08x, is_sirq = %(3)d ]
+0x01004006  CPU%(cpu)d  %(tsc)d (+%(reltsc)8d)  tasklet_migr [ ]
+
 0x00084001  CPU%(cpu)d  %(tsc)d (+%(reltsc)8d)  hpet create [ tn = %(1)d, irq = %(2)d, delta = 0x%(4)08x%(3)08x, period = 0x%(6)08x%(5)08x ]
 0x00084002  CPU%(cpu)d  %(tsc)d (+%(reltsc)8d)  pit create [ delta = 0x%(1)016x, period = 0x%(2)016x ]
 0x00084003  CPU%(cpu)d  %(tsc)d (+%(reltsc)8d)  rtc create [ delta = 0x%(1)016x , period = 0x%(2)016x ]
diff --git a/tools/xentrace/xenalyze.c b/tools/xentrace/xenalyze.c
index 5cb0f3b..eecdd61 100644
--- a/tools/xentrace/xenalyze.c
+++ b/tools/xentrace/xenalyze.c
@@ -8762,6 +8762,94 @@  void softirq_process(struct pcpu_info *p) {
     }
 }
 
+void tasklet_process(struct pcpu_info *p) {
+    struct record_info *ri = &p->ri;
+
+    switch ( ri->event )
+    {
+    case TRC_XEN_TASKLET_ENQUEUE:
+    {
+        struct {
+            uint64_t addr;
+        } *r = (typeof(r))ri->d;
+
+        if ( opt.dump_all )
+        {
+            printf(" %s tasklet_enqueue fn=%p\n",
+                   ri->dump_header, (void*)r->addr);
+        }
+        break;
+    }
+    case TRC_XEN_TASKLET_SCHEDULE:
+    {
+        struct {
+            uint64_t addr;
+            int16_t sched_on, is_sirq;
+        } *r = (typeof(r))ri->d;
+
+        if ( opt.dump_all )
+        {
+            printf(" %s tasklet_schedule fn=%p, sched_on=%d%s\n",
+                   ri->dump_header, (void*)r->addr, r->sched_on,
+                   r->is_sirq ? " (softirq)" : "");
+        }
+        break;
+    }
+    case TRC_XEN_TASKLET_WORK:
+    {
+        struct {
+            uint64_t addr;
+        } *r = (typeof(r))ri->d;
+
+        if ( opt.dump_all )
+        {
+            printf(" %s tasklet_do_work fn=%p\n",
+                   ri->dump_header, (void*)r->addr);
+        }
+        break;
+    }
+    case TRC_XEN_TASKLET_KILL:
+    {
+        struct {
+            uint64_t addr;
+            int16_t sched_on, is_run;
+        } *r = (typeof(r))ri->d;
+
+        if ( opt.dump_all )
+        {
+            printf(" %s tasklet_kill fn=%p\n, sched_on=%d, is_running=%d\n",
+                   ri->dump_header, (void*)r->addr, r->sched_on, r->is_run);
+        }
+        break;
+    }
+    case TRC_XEN_TASKLET_INIT:
+    {
+        struct {
+            uint64_t addr;
+            uint32_t is_sirq;
+        } *r = (typeof(r))ri->d;
+
+        if ( opt.dump_all )
+        {
+            printf(" %s tasklet_init fn=%p%s\n",
+                   ri->dump_header, (void*)r->addr,
+                   r->is_sirq ? ", (softirq)" : "");
+        }
+        break;
+    }
+    case TRC_XEN_TASKLET_MIGR:
+    {
+        if ( opt.dump_all )
+            printf(" %s tasklet_migrate\n", ri->dump_header);
+        break;
+    }
+    default:
+        if( opt.dump_all )
+            dump_generic(stdout, ri);
+        break;
+    }
+}
+
 #define TRC_HW_SUB_PM 1
 #define TRC_HW_SUB_IRQ 2
 void hw_process(struct pcpu_info *p)
@@ -8782,6 +8870,7 @@  void hw_process(struct pcpu_info *p)
 
 #define TRC_XEN_SUB_RCU 1
 #define TRC_XEN_SUB_SIRQ 2
+#define TRC_XEN_SUB_TSKLT 4
 void xen_process(struct pcpu_info *p)
 {
     struct record_info *ri = &p->ri;
@@ -8794,6 +8883,9 @@  void xen_process(struct pcpu_info *p)
     case TRC_XEN_SUB_SIRQ:
         softirq_process(p);
         break;
+    case TRC_XEN_SUB_TSKLT:
+        tasklet_process(p);
+        break;
     }
 }