[all-commits] [llvm/llvm-project] fc5ef5: [trace][intelpt] Support system-wide tracing [12] ...

walter erquinigo via All-commits all-commits at lists.llvm.org
Wed Jun 15 13:28:51 PDT 2022


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: fc5ef57c7df5805c828de2e3e334c2cf74648e58
      https://github.com/llvm/llvm-project/commit/fc5ef57c7df5805c828de2e3e334c2cf74648e58
  Author: Walter Erquinigo <wallace at fb.com>
  Date:   2022-06-15 (Wed, 15 Jun 2022)

  Changed paths:
    M lldb/docs/lldb-gdb-remote.txt
    M lldb/docs/use/intel_pt.rst
    M lldb/include/lldb/Target/Trace.h
    M lldb/include/lldb/Utility/TraceGDBRemotePackets.h
    M lldb/source/Plugins/Process/Linux/IntelPTCollector.cpp
    M lldb/source/Plugins/Process/Linux/IntelPTMultiCoreTrace.cpp
    M lldb/source/Plugins/Process/Linux/IntelPTMultiCoreTrace.h
    M lldb/source/Plugins/Process/Linux/IntelPTPerThreadProcessTrace.cpp
    M lldb/source/Plugins/Process/Linux/IntelPTPerThreadProcessTrace.h
    M lldb/source/Plugins/Process/Linux/IntelPTProcessTrace.h
    M lldb/source/Plugins/Process/Linux/IntelPTSingleBufferTrace.cpp
    M lldb/source/Plugins/Process/Linux/IntelPTThreadTraceCollection.cpp
    M lldb/source/Plugins/Process/Linux/IntelPTThreadTraceCollection.h
    M lldb/source/Plugins/Process/Linux/Perf.cpp
    M lldb/source/Plugins/Process/Linux/Perf.h
    M lldb/source/Plugins/Trace/common/CMakeLists.txt
    M lldb/source/Plugins/Trace/common/ThreadPostMortemTrace.cpp
    M lldb/source/Plugins/Trace/common/ThreadPostMortemTrace.h
    R lldb/source/Plugins/Trace/common/TraceJSONStructs.cpp
    R lldb/source/Plugins/Trace/common/TraceJSONStructs.h
    R lldb/source/Plugins/Trace/common/TraceSessionFileParser.cpp
    R lldb/source/Plugins/Trace/common/TraceSessionFileParser.h
    R lldb/source/Plugins/Trace/common/TraceSessionSaver.cpp
    R lldb/source/Plugins/Trace/common/TraceSessionSaver.h
    M lldb/source/Plugins/Trace/intel-pt/TraceIntelPT.cpp
    M lldb/source/Plugins/Trace/intel-pt/TraceIntelPT.h
    M lldb/source/Plugins/Trace/intel-pt/TraceIntelPTJSONStructs.cpp
    M lldb/source/Plugins/Trace/intel-pt/TraceIntelPTJSONStructs.h
    M lldb/source/Plugins/Trace/intel-pt/TraceIntelPTSessionFileParser.cpp
    M lldb/source/Plugins/Trace/intel-pt/TraceIntelPTSessionFileParser.h
    M lldb/source/Plugins/Trace/intel-pt/TraceIntelPTSessionSaver.cpp
    M lldb/source/Plugins/Trace/intel-pt/TraceIntelPTSessionSaver.h
    M lldb/source/Target/Trace.cpp
    M lldb/source/Utility/TraceGDBRemotePackets.cpp
    M lldb/source/Utility/TraceIntelPTGDBRemotePackets.cpp
    M lldb/test/API/commands/trace/TestTraceLoad.py
    M lldb/test/API/commands/trace/TestTraceSave.py
    M lldb/test/API/commands/trace/TestTraceSchema.py
    M lldb/test/API/commands/trace/intelpt-trace-multi-file/multi-file-no-ld.json
    M lldb/test/API/commands/trace/intelpt-trace/trace.json
    M lldb/test/API/commands/trace/intelpt-trace/trace_2threads.json
    M lldb/test/API/commands/trace/intelpt-trace/trace_bad.json
    M lldb/test/API/commands/trace/intelpt-trace/trace_bad2.json
    M lldb/test/API/commands/trace/intelpt-trace/trace_bad3.json
    M lldb/test/API/commands/trace/intelpt-trace/trace_bad4.json
    M lldb/test/API/commands/trace/intelpt-trace/trace_bad5.json
    M lldb/test/API/commands/trace/intelpt-trace/trace_bad_image.json
    M lldb/test/API/commands/trace/intelpt-trace/trace_wrong_cpu.json
    M lldb/unittests/Process/Linux/PerfTests.cpp
    M lldb/unittests/Utility/TraceGDBRemotePacketsTest.cpp

  Log Message:
  -----------
  [trace][intelpt] Support system-wide tracing [12] - Support multi-core trace load and save

:q!
This diff is massive, but it's because it connects the client with lldb-server
and also ensures that the postmortem case works.

- Flatten the postmortem trace schema. The reason is that the schema has become quite complex due to the new multicore case, which defeats the original purpose of having a schema that could work for every trace plug-in. At this point, it's better that each trace plug-in defines it's own full schema. This means that the only common field is "type".
-- Because of this new approach, I merged the "common" trace load and saving functionalities into the IntelPT one. This simplified the code quite a bit. If we eventually implement another trace plug-in, we can see then what we could reuse.
-- The new schema, which is flattened, has now better comments and is parsed better. A change I did was to disallow hex addresses, because they are a bit error prone. I'm asking now to print the address in decimal.
-- Renamed "intel" to "GenuineIntel" in the schema because that's what you see in /proc/cpuinfo.
- Implemented reading the context switch trace data buffer. I had to do
some refactors to do that cleanly.
-- A major change that I did here was to simplify the perf_event circular buffer reading logic. It was too complex. Maybe the original Intel author had something different in mind.
- Implemented all the necessary bits to read trace.json files with per-core data.
- Implemented all the necessary bits to save to disk per-core trace session.
- Added a test that ensures that parsing and saving to disk works.

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




More information about the All-commits mailing list