summaryrefslogtreecommitdiff
path: root/cmds/lshal/TableEntry.cpp
diff options
context:
space:
mode:
author Yifan Hong <elsk@google.com> 2017-09-14 18:23:38 -0700
committer Yifan Hong <elsk@google.com> 2017-09-15 12:36:50 -0700
commitfee209dda24dc94277df020fee3d91f1194e5ea1 (patch)
treecdcf51a4fe30f62b4c2f4340d1352870c2ad3459 /cmds/lshal/TableEntry.cpp
parent22ea7b851dbe753eda2a703952bbc803c1dcfc1f (diff)
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
Diffstat (limited to 'cmds/lshal/TableEntry.cpp')
-rw-r--r--cmds/lshal/TableEntry.cpp21
1 files changed, 19 insertions, 2 deletions
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 <android-base/logging.h>
+#include <hidl-hash/Hash.h>
+
#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<int>(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<int>(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<std::string(const std::string&)>& emitDebugInfo) const {