|
|
|
@ -1071,7 +1071,10 @@ void uORB::DeviceMaster::showTop(char **topic_filter, int num_filters)
@@ -1071,7 +1071,10 @@ void uORB::DeviceMaster::showTop(char **topic_filter, int num_filters)
|
|
|
|
|
fds.events = POLLIN; |
|
|
|
|
bool quit = false; |
|
|
|
|
|
|
|
|
|
hrt_abstime start_time = hrt_absolute_time(); |
|
|
|
|
|
|
|
|
|
while (!quit) { |
|
|
|
|
|
|
|
|
|
/* Sleep 200 ms waiting for user input five times ~ 1s */ |
|
|
|
|
for (int k = 0; k < 5; k++) { |
|
|
|
|
char c; |
|
|
|
@ -1092,6 +1095,25 @@ void uORB::DeviceMaster::showTop(char **topic_filter, int num_filters)
@@ -1092,6 +1095,25 @@ void uORB::DeviceMaster::showTop(char **topic_filter, int num_filters)
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if (!quit) { |
|
|
|
|
|
|
|
|
|
//update the stats
|
|
|
|
|
hrt_abstime current_time = hrt_absolute_time(); |
|
|
|
|
float dt = (current_time - start_time) / 1.e6f; |
|
|
|
|
cur_node = first_node; |
|
|
|
|
|
|
|
|
|
while (cur_node) { |
|
|
|
|
uint32_t num_lost = cur_node->node->lost_message_count(); |
|
|
|
|
unsigned int num_msgs = cur_node->node->published_message_count(); |
|
|
|
|
cur_node->pub_msg_delta = (num_msgs - cur_node->last_pub_msg_count) / dt; |
|
|
|
|
cur_node->lost_msg_delta = (num_lost - cur_node->last_lost_msg_count) / dt; |
|
|
|
|
cur_node->last_lost_msg_count = num_lost; |
|
|
|
|
cur_node->last_pub_msg_count = num_msgs; |
|
|
|
|
cur_node = cur_node->next; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
start_time = current_time; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
printf("\033[H"); // move cursor home and clear screen
|
|
|
|
|
printf(CLEAR_LINE "update: 1s, num topics: %i\n", num_topics); |
|
|
|
|
#ifdef __PX4_NUTTX |
|
|
|
@ -1102,23 +1124,18 @@ void uORB::DeviceMaster::showTop(char **topic_filter, int num_filters)
@@ -1102,23 +1124,18 @@ void uORB::DeviceMaster::showTop(char **topic_filter, int num_filters)
|
|
|
|
|
cur_node = first_node; |
|
|
|
|
|
|
|
|
|
while (cur_node) { |
|
|
|
|
uint32_t num_lost = cur_node->node->lost_message_count(); |
|
|
|
|
unsigned int num_msgs = cur_node->node->published_message_count(); |
|
|
|
|
|
|
|
|
|
if (!print_active_only || num_msgs - cur_node->last_pub_msg_count > 0) { |
|
|
|
|
if (!print_active_only || cur_node->pub_msg_delta > 0) { |
|
|
|
|
#ifdef __PX4_NUTTX |
|
|
|
|
printf(CLEAR_LINE "%*-s %2i %4i %4i %5i %i\n", (int)max_topic_name_length, |
|
|
|
|
#else |
|
|
|
|
printf(CLEAR_LINE "%*s %2i %4i %4i %5i %i\n", -(int)max_topic_name_length, |
|
|
|
|
#endif |
|
|
|
|
cur_node->node->meta()->o_name, (int)cur_node->instance, |
|
|
|
|
cur_node->node->subscriber_count(), num_msgs - cur_node->last_pub_msg_count, |
|
|
|
|
num_lost - cur_node->last_lost_msg_count, cur_node->node->queue_size()); |
|
|
|
|
cur_node->node->subscriber_count(), cur_node->pub_msg_delta, |
|
|
|
|
cur_node->lost_msg_delta, cur_node->node->queue_size()); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
cur_node->last_lost_msg_count = num_lost; |
|
|
|
|
cur_node->last_pub_msg_count = num_msgs; |
|
|
|
|
|
|
|
|
|
cur_node = cur_node->next; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|