[Statistics] Move GetStatDescription to an header file.

In preparation for using it in the API.

<rdar://problem/36555975>

llvm-svn: 330147
This commit is contained in:
Davide Italiano 2018-04-16 18:25:57 +00:00
parent 25eae5c879
commit 70539360e6
2 changed files with 18 additions and 18 deletions

View File

@ -246,6 +246,23 @@ enum StatisticKind {
StatisticMax = 4
};
std::string GetStatDescription(lldb_private::StatisticKind K) {
switch (K) {
case StatisticKind::ExpressionSuccessful:
return "Number of expr evaluation successes";
case StatisticKind::ExpressionFailure:
return "Number of expr evaluation failures";
case StatisticKind::FrameVarSuccess:
return "Number of frame var successes";
case StatisticKind::FrameVarFailure:
return "Number of frame var failures";
case StatisticKind::StatisticMax:
return "";
}
llvm_unreachable("Statistic not registered!");
}
} // namespace lldb_private
namespace llvm {

View File

@ -67,23 +67,6 @@ protected:
};
class CommandObjectStatsDump : public CommandObjectParsed {
private:
std::string GetStatDescription(lldb_private::StatisticKind K) {
switch (K) {
case StatisticKind::ExpressionSuccessful:
return "Number of expr evaluation successes";
case StatisticKind::ExpressionFailure:
return "Number of expr evaluation failures";
case StatisticKind::FrameVarSuccess:
return "Number of frame var successes";
case StatisticKind::FrameVarFailure:
return "Number of frame var failures";
case StatisticKind::StatisticMax:
return "";
}
llvm_unreachable("Statistic not registered!");
}
public:
CommandObjectStatsDump(CommandInterpreter &interpreter)
: CommandObjectParsed(interpreter, "dump", "Dump statistics results",
@ -99,7 +82,7 @@ protected:
for (auto &stat : target->GetStatistics()) {
result.AppendMessageWithFormat(
"%s : %u\n",
GetStatDescription(static_cast<lldb_private::StatisticKind>(i))
lldb_private::GetStatDescription(static_cast<lldb_private::StatisticKind>(i))
.c_str(),
stat);
i += 1;