From fee209dda24dc94277df020fee3d91f1194e5ea1 Mon Sep 17 00:00:00 2001 From: Yifan Hong Date: Thu, 14 Sep 2017 18:23:38 -0700 Subject: lshal: add Released column. Example output: $ lshal --neat -lis ... Y android.hardware.configstore@1.0::ISurfaceFlingerConfigs/default 7f5fe8f4f8a24037153c504d8b4d3313c2ce33d81c8c69fe5194ddd2d4080e72 android.hardware.configstore@1.1::ISurfaceFlingerConfigs/default 0000000000000000000000000000000000000000000000000000000000000000 ... Bug: 65123158 Test: lshal_test Test: lshal Test: lshal -ils Test: lshal --help Change-Id: I18e52eb977461d68909057583be8223d53f6748b --- cmds/lshal/TableEntry.cpp | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) (limited to 'cmds/lshal/TableEntry.cpp') diff --git a/cmds/lshal/TableEntry.cpp b/cmds/lshal/TableEntry.cpp index cbcf979f90..e8792a4307 100644 --- a/cmds/lshal/TableEntry.cpp +++ b/cmds/lshal/TableEntry.cpp @@ -16,6 +16,8 @@ #define LOG_TAG "lshal" #include +#include + #include "TableEntry.h" #include "TextTable.h" @@ -53,8 +55,10 @@ static std::string getTitle(TableColumnType type) { case TableColumnType::CLIENT_CMDS: return "Clients CMD"; case TableColumnType::ARCH: return "Arch"; case TableColumnType::THREADS: return "Thread Use"; + case TableColumnType::RELEASED: return "R"; + case TableColumnType::HASH: return "Hash"; default: - LOG(FATAL) << "Should not reach here."; + LOG(FATAL) << __func__ << "Should not reach here. " << static_cast(type); return ""; } } @@ -79,12 +83,25 @@ std::string TableEntry::getField(TableColumnType type) const { return getArchString(arch); case TableColumnType::THREADS: return getThreadUsage(); + case TableColumnType::RELEASED: + return isReleased(); + case TableColumnType::HASH: + return hash; default: - LOG(FATAL) << "Should not reach here."; + LOG(FATAL) << __func__ << "Should not reach here. " << static_cast(type); return ""; } } +std::string TableEntry::isReleased() const { + static const std::string unreleased = Hash::hexString(Hash::kEmptyHash); + + if (hash.empty() || hash == unreleased) { + return " "; // unknown or unreleased + } + return "Y"; // released +} + TextTable Table::createTextTable(bool neat, const std::function& emitDebugInfo) const { -- cgit v1.2.3-59-g8ed1b