[Lldb-commits] [lldb] 8271220 - [trace][intelpt] Instruction count in trace info

Alisamar Husain via lldb-commits lldb-commits at lists.llvm.org
Sat Mar 19 22:58:38 PDT 2022


Author: Alisamar Husain
Date: 2022-03-20T11:28:16+05:30
New Revision: 8271220a9981d0cb3186e8fc25477f622ea5c2c9

URL: https://github.com/llvm/llvm-project/commit/8271220a9981d0cb3186e8fc25477f622ea5c2c9
DIFF: https://github.com/llvm/llvm-project/commit/8271220a9981d0cb3186e8fc25477f622ea5c2c9.diff

LOG: [trace][intelpt] Instruction count in trace info

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

Added: 
    

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

Removed: 
    


################################################################################
diff  --git a/lldb/source/Plugins/Trace/intel-pt/TraceIntelPT.cpp b/lldb/source/Plugins/Trace/intel-pt/TraceIntelPT.cpp
index 6ec957771e47d..831cd3764672c 100644
--- a/lldb/source/Plugins/Trace/intel-pt/TraceIntelPT.cpp
+++ b/lldb/source/Plugins/Trace/intel-pt/TraceIntelPT.cpp
@@ -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;
 }
 

diff  --git a/lldb/test/API/commands/trace/TestTraceDumpInfo.py b/lldb/test/API/commands/trace/TestTraceDumpInfo.py
index 99877aaa27ae5..18088e07b8df3 100644
--- a/lldb/test/API/commands/trace/TestTraceDumpInfo.py
+++ b/lldb/test/API/commands/trace/TestTraceDumpInfo.py
@@ -38,4 +38,5 @@ def testDumpRawTraceSize(self):
             substrs=['''Trace technology: intel-pt
 
 thread #1: tid = 3842849
-  Raw trace size: 4096 bytes'''])
+  Raw trace size: 4096 bytes
+  Total number of instructions: 21'''])


        


More information about the lldb-commits mailing list