Skip to content

Commit

Permalink
Revert "Support statistics dump summary only mode (#80745)"
Browse files Browse the repository at this point in the history
This reverts commit 2217837.
  • Loading branch information
kusmour committed Feb 7, 2024
1 parent 4476727 commit 0542e00
Show file tree
Hide file tree
Showing 19 changed files with 87 additions and 297 deletions.
1 change: 0 additions & 1 deletion lldb/bindings/headers.swig
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,6 @@
#include "lldb/API/SBScriptObject.h"
#include "lldb/API/SBSection.h"
#include "lldb/API/SBSourceManager.h"
#include "lldb/API/SBStatisticsOptions.h"
#include "lldb/API/SBStream.h"
#include "lldb/API/SBStringList.h"
#include "lldb/API/SBStructuredData.h"
Expand Down
8 changes: 0 additions & 8 deletions lldb/bindings/interface/SBStatisticsOptionsDocStrings.i

This file was deleted.

2 changes: 0 additions & 2 deletions lldb/bindings/interfaces.swig
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,6 @@
%include "./interface/SBReproducerDocstrings.i"
%include "./interface/SBSectionDocstrings.i"
%include "./interface/SBSourceManagerDocstrings.i"
%include "./interface/SBStatisticsOptionsDocstrings.i"
%include "./interface/SBStreamDocstrings.i"
%include "./interface/SBStringListDocstrings.i"
%include "./interface/SBStructuredDataDocstrings.i"
Expand Down Expand Up @@ -132,7 +131,6 @@
%include "lldb/API/SBScriptObject.h"
%include "lldb/API/SBSection.h"
%include "lldb/API/SBSourceManager.h"
%include "lldb/API/SBStatisticsOptions.h"
%include "lldb/API/SBStream.h"
%include "lldb/API/SBStringList.h"
%include "lldb/API/SBStructuredData.h"
Expand Down
1 change: 0 additions & 1 deletion lldb/include/lldb/API/LLDB.h
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,6 @@
#include "lldb/API/SBReproducer.h"
#include "lldb/API/SBSection.h"
#include "lldb/API/SBSourceManager.h"
#include "lldb/API/SBStatisticsOptions.h"
#include "lldb/API/SBStream.h"
#include "lldb/API/SBStringList.h"
#include "lldb/API/SBStructuredData.h"
Expand Down
1 change: 0 additions & 1 deletion lldb/include/lldb/API/SBDefines.h
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,6 @@ class LLDB_API SBReproducer;
class LLDB_API SBScriptObject;
class LLDB_API SBSection;
class LLDB_API SBSourceManager;
class LLDB_API SBStatisticsOptions;
class LLDB_API SBStream;
class LLDB_API SBStringList;
class LLDB_API SBStructuredData;
Expand Down
36 changes: 0 additions & 36 deletions lldb/include/lldb/API/SBStatisticsOptions.h

This file was deleted.

10 changes: 0 additions & 10 deletions lldb/include/lldb/API/SBTarget.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
#include "lldb/API/SBFileSpec.h"
#include "lldb/API/SBFileSpecList.h"
#include "lldb/API/SBLaunchInfo.h"
#include "lldb/API/SBStatisticsOptions.h"
#include "lldb/API/SBSymbolContextList.h"
#include "lldb/API/SBType.h"
#include "lldb/API/SBValue.h"
Expand Down Expand Up @@ -91,15 +90,6 @@ class LLDB_API SBTarget {
/// A SBStructuredData with the statistics collected.
lldb::SBStructuredData GetStatistics();

/// Returns a dump of the collected statistics.
///
/// \param[in] options
/// An objects object that contains all options for the statistics dumping.
///
/// \return
/// A SBStructuredData with the statistics collected.
lldb::SBStructuredData GetStatistics(SBStatisticsOptions options);

/// Return the platform object associated with the target.
///
/// After return, the platform object should be checked for
Expand Down
15 changes: 2 additions & 13 deletions lldb/include/lldb/Target/Statistics.h
Original file line number Diff line number Diff line change
Expand Up @@ -130,15 +130,10 @@ struct ConstStringStats {
ConstString::MemoryStats stats = ConstString::GetMemoryStats();
};

struct StatisticsOptions {
bool summary_only = false;
};

/// A class that represents statistics for a since lldb_private::Target.
class TargetStats {
public:
llvm::json::Value ToJSON(Target &target,
const lldb_private::StatisticsOptions &options);
llvm::json::Value ToJSON(Target &target);

void SetLaunchOrAttachTime();
void SetFirstPrivateStopTime();
Expand Down Expand Up @@ -176,15 +171,9 @@ class DebuggerStats {
/// The single target to emit statistics for if non NULL, otherwise dump
/// statistics only for the specified target.
///
/// \param summary_only
/// If true, only report high level summary statistics without
/// targets/modules/breakpoints etc.. details.
///
/// \return
/// Returns a JSON value that contains all target metrics.
static llvm::json::Value
ReportStatistics(Debugger &debugger, Target *target,
const lldb_private::StatisticsOptions &options);
static llvm::json::Value ReportStatistics(Debugger &debugger, Target *target);

protected:
// Collecting stats can be set to true to collect stats that are expensive
Expand Down
3 changes: 1 addition & 2 deletions lldb/include/lldb/Target/Target.h
Original file line number Diff line number Diff line change
Expand Up @@ -1599,8 +1599,7 @@ class Target : public std::enable_shared_from_this<Target>,
///
/// \return
/// Returns a JSON value that contains all target metrics.
llvm::json::Value
ReportStatistics(const lldb_private::StatisticsOptions &options);
llvm::json::Value ReportStatistics();

TargetStats &GetStatistics() { return m_stats; }

Expand Down
1 change: 0 additions & 1 deletion lldb/include/lldb/lldb-forward.h
Original file line number Diff line number Diff line change
Expand Up @@ -298,7 +298,6 @@ struct CompilerContext;
struct LineEntry;
struct PropertyDefinition;
struct ScriptSummaryFormat;
struct StatisticsOptions;
struct StringSummaryFormat;
template <unsigned N> class StreamBuffer;

Expand Down
1 change: 0 additions & 1 deletion lldb/source/API/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,6 @@ add_lldb_library(liblldb SHARED ${option_framework}
SBScriptObject.cpp
SBSection.cpp
SBSourceManager.cpp
SBStatisticsOptions.cpp
SBStream.cpp
SBStringList.cpp
SBStructuredData.cpp
Expand Down
49 changes: 0 additions & 49 deletions lldb/source/API/SBStatisticsOptions.cpp

This file was deleted.

13 changes: 3 additions & 10 deletions lldb/source/API/SBTarget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -199,22 +199,15 @@ SBDebugger SBTarget::GetDebugger() const {

SBStructuredData SBTarget::GetStatistics() {
LLDB_INSTRUMENT_VA(this);
SBStatisticsOptions options;
return GetStatistics(options);
}

SBStructuredData SBTarget::GetStatistics(SBStatisticsOptions options) {
LLDB_INSTRUMENT_VA(this);

SBStructuredData data;
TargetSP target_sp(GetSP());
if (!target_sp)
return data;
std::string json_str =
llvm::formatv("{0:2}", DebuggerStats::ReportStatistics(
target_sp->GetDebugger(), target_sp.get(),
options.ref()))
.str();
llvm::formatv("{0:2}",
DebuggerStats::ReportStatistics(target_sp->GetDebugger(),
target_sp.get())).str();
data.m_impl_up->SetObjectSP(StructuredData::ParseJSON(json_str));
return data;
}
Expand Down
10 changes: 1 addition & 9 deletions lldb/source/Commands/CommandObjectStats.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -75,9 +75,6 @@ class CommandObjectStatsDump : public CommandObjectParsed {
case 'a':
m_all_targets = true;
break;
case 's':
m_stats_options.summary_only = true;
break;
default:
llvm_unreachable("Unimplemented option");
}
Expand All @@ -86,17 +83,13 @@ class CommandObjectStatsDump : public CommandObjectParsed {

void OptionParsingStarting(ExecutionContext *execution_context) override {
m_all_targets = false;
m_stats_options = StatisticsOptions();
}

llvm::ArrayRef<OptionDefinition> GetDefinitions() override {
return llvm::ArrayRef(g_statistics_dump_options);
}

const StatisticsOptions &GetStatisticsOptions() { return m_stats_options; }

bool m_all_targets = false;
StatisticsOptions m_stats_options = StatisticsOptions();
};

public:
Expand All @@ -116,8 +109,7 @@ class CommandObjectStatsDump : public CommandObjectParsed {
target = m_exe_ctx.GetTargetPtr();

result.AppendMessageWithFormatv(
"{0:2}", DebuggerStats::ReportStatistics(
GetDebugger(), target, m_options.GetStatisticsOptions()));
"{0:2}", DebuggerStats::ReportStatistics(GetDebugger(), target));
result.SetStatus(eReturnStatusSuccessFinishResult);
}

Expand Down
3 changes: 0 additions & 3 deletions lldb/source/Commands/Options.td
Original file line number Diff line number Diff line change
Expand Up @@ -1412,7 +1412,4 @@ let Command = "trace schema" in {
let Command = "statistics dump" in {
def statistics_dump_all: Option<"all-targets", "a">, Group<1>,
Desc<"Include statistics for all targets.">;
def statistics_dump_summary: Option<"summary", "s">, Group<1>,
Desc<"Dump only high-level summary statistics."
"Exclude targets, modules, breakpoints etc... details.">;
}

0 comments on commit 0542e00

Please sign in to comment.