[trace][intelpt] Instruction count in trace info
authorAlisamar Husain <zrthxn@gmail.com>
Sat, 19 Mar 2022 19:58:04 +0000 (01:28 +0530)
committerAlisamar Husain <zrthxn@gmail.com>
Sun, 20 Mar 2022 05:58:16 +0000 (11:28 +0530)
Added a line to `thread trace dump info` results which shows total number of instructions executed until now.

Differential Revision: https://reviews.llvm.org/D122076

lldb/source/Plugins/Trace/intel-pt/TraceIntelPT.cpp
lldb/test/API/commands/trace/TestTraceDumpInfo.py

index 6ec9577..831cd37 100644 (file)
@@ -110,7 +110,10 @@ void TraceIntelPT::DumpTraceInfo(Thread &thread, Stream &s, bool verbose) {
     s.Printf(", not traced\n");
     return;
   }
-  s.Printf("\n  Raw trace size: %zu bytes\n", *raw_size);
+  s.Printf("\n");
+  s.Printf("  Raw trace size: %zu bytes\n", *raw_size);
+  s.Printf("  Total number of instructions: %zu\n", 
+    Decode(thread)->GetInstructions().size());
   return;
 }
 
index 99877aa..18088e0 100644 (file)
@@ -38,4 +38,5 @@ class TestTraceDumpInfo(TraceIntelPTTestCaseBase):
             substrs=['''Trace technology: intel-pt
 
 thread #1: tid = 3842849
-  Raw trace size: 4096 bytes'''])
+  Raw trace size: 4096 bytes
+  Total number of instructions: 21'''])