[all-commits] [llvm/llvm-project] 561a61: [trace][intelpt] Support system-wide tracing [18] ...

walter erquinigo via All-commits all-commits at lists.llvm.org
Thu Jun 16 11:42:38 PDT 2022


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

  Changed paths:
    M lldb/docs/lldb-gdb-remote.txt
    M lldb/include/lldb/Target/Trace.h
    M lldb/include/lldb/Utility/TraceGDBRemotePackets.h
    M lldb/source/Plugins/Process/Linux/IntelPTMultiCoreTrace.cpp
    M lldb/source/Plugins/Process/Linux/IntelPTSingleBufferTrace.cpp
    M lldb/source/Plugins/Process/Linux/IntelPTSingleBufferTrace.h
    M lldb/source/Plugins/Process/Linux/IntelPTThreadTraceCollection.cpp
    M lldb/source/Plugins/Process/Linux/Perf.cpp
    M lldb/source/Plugins/Process/Linux/Perf.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/TraceIntelPTSessionFileParser.cpp
    M lldb/source/Plugins/Trace/intel-pt/TraceIntelPTSessionFileParser.h
    M lldb/source/Plugins/Trace/intel-pt/TraceIntelPTSessionSaver.cpp
    M lldb/source/Target/Trace.cpp
    M lldb/source/Utility/TraceGDBRemotePackets.cpp

  Log Message:
  -----------
  [trace][intelpt] Support system-wide tracing [18] - some more improvements

This applies the changes requested for diff 12.

- use DenseMap<ConstString, _> instead of std::unordered_map<ConstString, _>, which is more idiomatic and possibly performant.
- deduplicate some code in Trace.cpp by using helper functions for fetching in maps
- stop using size and offset when fetching binary data, because we in fact read the entire buffers all the time. If we ever need streaming, we can implement it then. Now, the size is used only to check that we are getting the correct amount of data. This is useful because in some cases determining the size doesn't involve fetching the actual data.
- added back the x86_64 macro to the perf tests
- added more documentation
- simplified some file handling
- fixed some comments

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


  Commit: 67c24051450116c2c633e8a2740c08cf904e1605
      https://github.com/llvm/llvm-project/commit/67c24051450116c2c633e8a2740c08cf904e1605
  Author: Walter Erquinigo <wallace at fb.com>
  Date:   2022-06-16 (Thu, 16 Jun 2022)

  Changed paths:
    M lldb/source/Plugins/Trace/intel-pt/LibiptDecoder.cpp
    M lldb/source/Plugins/Trace/intel-pt/LibiptDecoder.h
    M lldb/source/Plugins/Trace/intel-pt/PerfContextSwitchDecoder.cpp
    M lldb/source/Plugins/Trace/intel-pt/PerfContextSwitchDecoder.h
    M lldb/source/Plugins/Trace/intel-pt/ThreadDecoder.cpp
    M lldb/source/Plugins/Trace/intel-pt/TraceIntelPTMultiCoreDecoder.cpp
    M lldb/source/Plugins/Trace/intel-pt/TraceIntelPTMultiCoreDecoder.h
    M lldb/source/Plugins/Trace/intel-pt/TraceIntelPTSessionFileParser.cpp

  Log Message:
  -----------
  [trace][intelpt] Support system-wide tracing [19] - Some other minor improvements

This addresses the issues in diffs [13], [14] and [16]

- Add better documentation
- Fix some castings by making them safer
- Simplify CorrelateContextSwitchesAndIntelPtTraces
- Rename some functions

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


  Commit: 6a5355e8a159bd9c058d4fbba2a87e0465fe0dc7
      https://github.com/llvm/llvm-project/commit/6a5355e8a159bd9c058d4fbba2a87e0465fe0dc7
  Author: Walter Erquinigo <wallace at fb.com>
  Date:   2022-06-16 (Thu, 16 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/include/lldb/Utility/TraceIntelPTGDBRemotePackets.h
    M lldb/include/lldb/lldb-types.h
    M lldb/packages/Python/lldbsuite/test/tools/intelpt/intelpt_testcase.py
    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/IntelPTSingleBufferTrace.cpp
    M lldb/source/Plugins/Process/Linux/IntelPTSingleBufferTrace.h
    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/Process/Linux/Procfs.cpp
    M lldb/source/Plugins/Process/Linux/Procfs.h
    M lldb/source/Plugins/Trace/intel-pt/CMakeLists.txt
    M lldb/source/Plugins/Trace/intel-pt/CommandObjectTraceStartIntelPT.cpp
    M lldb/source/Plugins/Trace/intel-pt/CommandObjectTraceStartIntelPT.h
    M lldb/source/Plugins/Trace/intel-pt/LibiptDecoder.cpp
    M lldb/source/Plugins/Trace/intel-pt/LibiptDecoder.h
    M lldb/source/Plugins/Trace/intel-pt/PerfContextSwitchDecoder.cpp
    M lldb/source/Plugins/Trace/intel-pt/PerfContextSwitchDecoder.h
    M lldb/source/Plugins/Trace/intel-pt/ThreadDecoder.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/TraceIntelPTConstants.h
    M lldb/source/Plugins/Trace/intel-pt/TraceIntelPTJSONStructs.cpp
    M lldb/source/Plugins/Trace/intel-pt/TraceIntelPTJSONStructs.h
    R lldb/source/Plugins/Trace/intel-pt/TraceIntelPTMultiCoreDecoder.cpp
    R lldb/source/Plugins/Trace/intel-pt/TraceIntelPTMultiCoreDecoder.h
    A lldb/source/Plugins/Trace/intel-pt/TraceIntelPTMultiCpuDecoder.cpp
    A lldb/source/Plugins/Trace/intel-pt/TraceIntelPTMultiCpuDecoder.h
    M lldb/source/Plugins/Trace/intel-pt/TraceIntelPTOptions.td
    M lldb/source/Plugins/Trace/intel-pt/TraceIntelPTSessionFileParser.cpp
    M lldb/source/Plugins/Trace/intel-pt/TraceIntelPTSessionSaver.cpp
    M lldb/source/Target/Trace.cpp
    M lldb/source/Utility/TraceGDBRemotePackets.cpp
    M lldb/source/Utility/TraceIntelPTGDBRemotePackets.cpp
    M lldb/test/API/commands/trace/TestTraceSave.py
    M lldb/test/API/commands/trace/TestTraceSchema.py
    M lldb/test/API/commands/trace/TestTraceStartStop.py
    M lldb/test/API/commands/trace/intelpt-multi-core-trace/trace.json
    M lldb/test/API/commands/trace/intelpt-multi-core-trace/trace_missing_threads.json
    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_bad2.json
    M lldb/test/API/commands/trace/intelpt-trace/trace_bad3.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/test/API/commands/trace/multiple-threads/TestTraceStartStopMultipleThreads.py
    M lldb/unittests/Process/Linux/ProcfsTests.cpp

  Log Message:
  -----------
  [trace][intelpt] Support system-wide tracing [20] - Rename some fields in the schema

As discusses offline with @jj10305, we are updating some naming used throughout the code, specially in the json schema

- traceBuffer -> iptTrace
- core -> cpu

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


  Commit: 9f45f23d860251edceed6128110855c51af4f39f
      https://github.com/llvm/llvm-project/commit/9f45f23d860251edceed6128110855c51af4f39f
  Author: Walter Erquinigo <wallace at fb.com>
  Date:   2022-06-16 (Thu, 16 Jun 2022)

  Changed paths:
    M lldb/docs/lldb-gdb-remote.txt
    M lldb/include/lldb/Utility/TraceIntelPTGDBRemotePackets.h
    M lldb/source/Plugins/Process/Linux/IntelPTMultiCoreTrace.cpp
    M lldb/source/Plugins/Process/Linux/IntelPTProcessTrace.h
    M lldb/source/Plugins/Process/Linux/Perf.cpp
    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/TraceIntelPTSessionSaver.cpp
    M lldb/source/Utility/TraceIntelPTGDBRemotePackets.cpp
    M lldb/test/API/commands/trace/TestTraceLoad.py
    A lldb/test/API/commands/trace/intelpt-multi-core-trace/trace_with_string_numbers.json

  Log Message:
  -----------
  [trace][intelpt] Support system-wide tracing [21] - Support long numbers in JSON

llvm's JSON parser supports 64 bit integers, but other tools like the
ones written in JS don't support numbers that big, so we need to
represent these possibly big numbers as a string. This diff uses that to
represent addresses and tsc zero. The former is printed in hex for and
the latter in decimal string form. The schema was updated mentioning
that.

Besides that, I fixed some remaining issues and now all test pass. Before I wasn't running all tests because for some reason my computer reverted perf_paranoid to 1.

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


  Commit: ea37cd52d147a5ee621418e65db93a3e6102ab89
      https://github.com/llvm/llvm-project/commit/ea37cd52d147a5ee621418e65db93a3e6102ab89
  Author: Walter Erquinigo <wallace at fb.com>
  Date:   2022-06-16 (Thu, 16 Jun 2022)

  Changed paths:
    M lldb/source/Plugins/Process/Linux/Perf.cpp
    M lldb/source/Plugins/Trace/intel-pt/LibiptDecoder.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/TraceIntelPTMultiCpuDecoder.cpp
    M lldb/source/Plugins/Trace/intel-pt/TraceIntelPTMultiCpuDecoder.h
    M lldb/source/Plugins/Trace/intel-pt/TraceIntelPTSessionFileParser.cpp
    M lldb/source/Plugins/Trace/intel-pt/forward-declarations.h
    M lldb/source/Target/Trace.cpp

  Log Message:
  -----------
  [trace][intelpt] Support system-wide tracing [22] - Some final touches

Having a member variable TraceIntelPT * makes it look as if it was
optional. I'm using instead a weak_ptr to indicate that it's not
optional and the object is under the ownership of TraceIntelPT.

Besides that, I've simplified the Perf aux and data buffers copying by
using vector.insert.

I'm also renaming Lookup2 to Lookup. The 2 in the name is confusing.

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


Compare: https://github.com/llvm/llvm-project/compare/d0e60b6d7ec9...ea37cd52d147


More information about the All-commits mailing list