mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-10-20 04:23:33 +08:00
top: add module description & usage
This commit is contained in:
@@ -50,12 +50,22 @@
|
|||||||
#include <systemlib/cpuload.h>
|
#include <systemlib/cpuload.h>
|
||||||
#include <systemlib/printload.h>
|
#include <systemlib/printload.h>
|
||||||
#include <drivers/drv_hrt.h>
|
#include <drivers/drv_hrt.h>
|
||||||
|
#include <px4_module.h>
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Start the top application.
|
* Start the top application.
|
||||||
*/
|
*/
|
||||||
__EXPORT int top_main(int argc, char *argv[]);
|
__EXPORT int top_main(int argc, char *argv[]);
|
||||||
|
|
||||||
|
|
||||||
|
static void print_usage(void)
|
||||||
|
{
|
||||||
|
PRINT_MODULE_DESCRIPTION("Monitor running processes and their CPU, stack usage, priority and state");
|
||||||
|
|
||||||
|
PRINT_MODULE_USAGE_NAME_SIMPLE("top", "system");
|
||||||
|
PRINT_MODULE_USAGE_COMMAND_DESCR("once", "print load only once");
|
||||||
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
top_main(int argc, char *argv[])
|
top_main(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
@@ -67,10 +77,16 @@ top_main(int argc, char *argv[])
|
|||||||
/* clear screen */
|
/* clear screen */
|
||||||
dprintf(1, "\033[2J\n");
|
dprintf(1, "\033[2J\n");
|
||||||
|
|
||||||
if (argc > 1 && !strcmp(argv[1], "once")) {
|
if (argc > 1) {
|
||||||
print_load(curr_time, 1, &load);
|
if (!strcmp(argv[1], "once")) {
|
||||||
sleep(1);
|
print_load(curr_time, 1, &load);
|
||||||
print_load(hrt_absolute_time(), 1, &load);
|
sleep(1);
|
||||||
|
print_load(hrt_absolute_time(), 1, &load);
|
||||||
|
|
||||||
|
} else {
|
||||||
|
print_usage();
|
||||||
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user