Teach aos_dump that not all channels are readable everywhere
When we have dozens of channels on a dozens nodes, we have a bunch of
irrelevant channels being displayed. This makes it hard. Instead,
teach aos_dump to only display the channels that the user can show (with
a flag to override in case the user actually wants something else).
Change-Id: Ib0a7a9303fa1862aa622d34e309374e9e519429e
diff --git a/aos/aos_dump.cc b/aos/aos_dump.cc
index 055700f..a0cca5d 100644
--- a/aos/aos_dump.cc
+++ b/aos/aos_dump.cc
@@ -14,6 +14,9 @@
"If true, fetch the current message on the channel first");
DEFINE_bool(pretty, false,
"If true, pretty print the messages on multiple lines");
+DEFINE_bool(all, false,
+ "If true, print out the channels for all nodes, not just the "
+ "channels which are visible on this node.");
DEFINE_bool(print_timestamps, true, "If true, timestamps are printed.");
DEFINE_uint64(count, 0,
"If >0, aos_dump will exit after printing this many messages.");
@@ -75,8 +78,11 @@
if (argc == 1) {
std::cout << "Channels:\n";
for (const aos::Channel *channel : *config_msg->channels()) {
- std::cout << channel->name()->c_str() << ' ' << channel->type()->c_str()
- << '\n';
+ if (FLAGS_all || aos::configuration::ChannelIsReadableOnNode(
+ channel, event_loop.node())) {
+ std::cout << channel->name()->c_str() << ' ' << channel->type()->c_str()
+ << '\n';
+ }
}
return 0;
}
@@ -86,6 +92,10 @@
config_msg->channels();
bool found_exact = false;
for (const aos::Channel *channel : *channels) {
+ if (!FLAGS_all && !aos::configuration::ChannelIsReadableOnNode(
+ channel, event_loop.node())) {
+ continue;
+ }
if (channel->name()->c_str() != channel_name) {
continue;
}