mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-10-15 00:43:34 +08:00
UAVCAN memory usage status and shrink
This commit is contained in:
committed by
Lorenz Meier
parent
e6182b8d2b
commit
a570d1de7d
@@ -1120,6 +1120,13 @@ UavcanNode::print_info()
|
||||
|
||||
(void)pthread_mutex_lock(&_node_mutex);
|
||||
|
||||
// Memory status
|
||||
printf("Pool allocator status:\n");
|
||||
printf("\tCapacity hard/soft: %u/%u blocks\n",
|
||||
_pool_allocator.getBlockCapacityHardLimit(), _pool_allocator.getBlockCapacity());
|
||||
printf("\tReserved: %u blocks\n", _pool_allocator.getNumReservedBlocks());
|
||||
printf("\tAllocated: %u blocks\n", _pool_allocator.getNumAllocatedBlocks());
|
||||
|
||||
// ESC mixer status
|
||||
printf("ESC actuators control groups: sub: %u / req: %u / fds: %u\n",
|
||||
(unsigned)_groups_subscribed, (unsigned)_groups_required, _poll_fds_num);
|
||||
@@ -1170,13 +1177,20 @@ UavcanNode::print_info()
|
||||
(void)pthread_mutex_unlock(&_node_mutex);
|
||||
}
|
||||
|
||||
void UavcanNode::shrink()
|
||||
{
|
||||
(void)pthread_mutex_lock(&_node_mutex);
|
||||
_pool_allocator.shrink();
|
||||
(void)pthread_mutex_unlock(&_node_mutex);
|
||||
}
|
||||
|
||||
/*
|
||||
* App entry point
|
||||
*/
|
||||
static void print_usage()
|
||||
{
|
||||
warnx("usage: \n"
|
||||
"\tuavcan {start [fw]|status|stop [all|fw]|arm|disarm|update fw|param [set|get|list|save] nodeid [name] [value]|reset nodeid}");
|
||||
"\tuavcan {start [fw]|status|stop [all|fw]|shrink|arm|disarm|update fw|param [set|get|list|save] nodeid [name] [value]|reset nodeid}");
|
||||
}
|
||||
|
||||
extern "C" __EXPORT int uavcan_main(int argc, char *argv[]);
|
||||
@@ -1252,6 +1266,11 @@ int uavcan_main(int argc, char *argv[])
|
||||
::exit(0);
|
||||
}
|
||||
|
||||
if (!std::strcmp(argv[1], "shrink")) {
|
||||
inst->shrink();
|
||||
::exit(0);
|
||||
}
|
||||
|
||||
if (!std::strcmp(argv[1], "arm")) {
|
||||
inst->arm_actuators(true);
|
||||
::exit(0);
|
||||
|
||||
@@ -123,6 +123,8 @@ public:
|
||||
|
||||
void print_info();
|
||||
|
||||
void shrink();
|
||||
|
||||
static UavcanNode *instance() { return _instance; }
|
||||
static int getHardwareVersion(uavcan::protocol::HardwareVersion &hwver);
|
||||
int fw_server(eServerAction action);
|
||||
|
||||
Reference in New Issue
Block a user