[Lldb-commits] [PATCH] D123357: [trace][intelpt] Add task timer classes

walter erquinigo via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Thu Apr 7 20:43:16 PDT 2022


wallace created this revision.
Herald added a subscriber: mgorny.
Herald added a project: All.
wallace requested review of this revision.
Herald added a project: LLDB.
Herald added a subscriber: lldb-commits.

I'm adding two new classes that can be used to measure the duration of long
tasks as process and thread level, e.g. decoding, fetching data from
lldb-server, etc. In this first patch, I'm using it to measure the time it takes
to decode each thread, which is printed out with the `dump info` command. In a
later patch I'll start adding process-level tasks and I might move these
classes to the upper Trace level, instead of having them in the intel-pt
plugin. I might need to do that anyway in the future when we have to
measure HTR. For now, I want to keep the impact of this change minimal.

With it, I was able to generate the following info of a very big trace:

  (lldb) thread trace dump info                                                                                                            Trace technology: intel-pt
  
  thread #1: tid = 616081
    Total number of instructions: 9729366
  
    Memory usage:
      Raw trace size: 1024 KiB
      Total approximate memory usage (excluding raw trace): 123517.34 KiB
      Average memory usage per instruction (excluding raw trace): 13.00 bytes
  
    Timing:
      Decoding instructions: 1.62s
  
    Errors:
      Number of TSC decoding errors: 0

As seen above, it took 1.62 seconds to decode 9.7M instructions. This is great
news, as we don't need to do any optimization work in this area.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D123357

Files:
  lldb/source/Plugins/Trace/intel-pt/CMakeLists.txt
  lldb/source/Plugins/Trace/intel-pt/DecodedThread.h
  lldb/source/Plugins/Trace/intel-pt/TaskTimer.cpp
  lldb/source/Plugins/Trace/intel-pt/TaskTimer.h
  lldb/source/Plugins/Trace/intel-pt/ThreadDecoder.cpp
  lldb/source/Plugins/Trace/intel-pt/TraceIntelPT.cpp
  lldb/source/Plugins/Trace/intel-pt/TraceIntelPT.h
  lldb/test/API/commands/trace/TestTraceDumpInfo.py
  lldb/test/API/commands/trace/TestTraceLoad.py

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D123357.421402.patch
Type: text/x-patch
Size: 10829 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20220408/3aa67ce6/attachment-0001.bin>


More information about the lldb-commits mailing list