[Lldb-commits] [lldb] Support statistics dump summary only mode (PR #80745)

Greg Clayton via lldb-commits lldb-commits at lists.llvm.org
Mon Feb 5 15:52:54 PST 2024


================
@@ -133,7 +133,7 @@ struct ConstStringStats {
 /// A class that represents statistics for a since lldb_private::Target.
 class TargetStats {
 public:
-  llvm::json::Value ToJSON(Target &target);
+  llvm::json::Value ToJSON(Target &target, bool summary_only = false);
----------------
clayborg wrote:

We probably want a lldb_private::StatisticsOptions class that contains all options:
```
struct StatisticsOptions {
  bool summary_only = false;
};
```
Then when you create the SBStatisticsOptions class, it should contain a `std::unique_ptr<lldb_private::StatisticsOptions> m_opaque_up;` member, just like all other public API classes. And the methods on `SBStatisticsOptions` will modify the contained `lldb_private::StatisticsOptions` object appropriately. The reason we need the `SBStatisticsOptions` class to have a single member that is a unique pointer is so if we add extra things to `lldb_private::StatisticsOptions`, it won't change the size of the `SBStatisticsOptions` class since it just has a `unique_ptr<lldb_private::StatisticsOptions>` as its only member variable, which makes it suitable for use in the public API. We can't change the size of our objects if we want to maintain a stable public API.


https://github.com/llvm/llvm-project/pull/80745


More information about the lldb-commits mailing list