Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
F
Firmware
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Alberto Ruiz Garcia
Firmware
Commits
509189ea
Commit
509189ea
authored
6 years ago
by
Beat Küng
Committed by
Daniel Agar
6 years ago
Browse files
Options
Downloads
Patches
Plain Diff
uorb top: add 'uorb top -1' to run only once
parent
66722848
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/modules/uORB/uORBDeviceMaster.cpp
+21
-11
21 additions, 11 deletions
src/modules/uORB/uORBDeviceMaster.cpp
src/modules/uORB/uORBMain.cpp
+1
-0
1 addition, 0 deletions
src/modules/uORB/uORBMain.cpp
with
22 additions
and
11 deletions
src/modules/uORB/uORBDeviceMaster.cpp
+
21
−
11
View file @
509189ea
...
...
@@ -249,13 +249,25 @@ void uORB::DeviceMaster::addNewDeviceNodes(DeviceNodeStatisticsData **first_node
void
uORB
::
DeviceMaster
::
showTop
(
char
**
topic_filter
,
int
num_filters
)
{
bool
print_active_only
=
true
;
bool
only_once
=
false
;
// if true, run only once, then exit
if
(
topic_filter
&&
num_filters
>
0
)
{
if
(
!
strcmp
(
"-a"
,
topic_filter
[
0
]))
{
num_filters
=
0
;
bool
show_all
=
false
;
for
(
int
i
=
0
;
i
<
num_filters
;
++
i
)
{
if
(
!
strcmp
(
"-a"
,
topic_filter
[
i
]))
{
show_all
=
true
;
}
else
if
(
!
strcmp
(
"-1"
,
topic_filter
[
i
]))
{
only_once
=
true
;
}
}
print_active_only
=
false
;
// print non-active if -a or some filter given
print_active_only
=
only_once
?
(
num_filters
==
1
)
:
false
;
// print non-active if -a or some filter given
if
(
show_all
||
print_active_only
)
{
num_filters
=
0
;
}
}
PX4_INFO_RAW
(
"
\033
[2J
\n
"
);
//clear screen
...
...
@@ -278,7 +290,7 @@ void uORB::DeviceMaster::showTop(char **topic_filter, int num_filters)
unlock
();
#ifdef __PX4_QURT //QuRT has no poll()
int
num_runs
=
0
;
only_once
=
true
;
#else
const
int
stdin_fileno
=
0
;
...
...
@@ -292,13 +304,7 @@ void uORB::DeviceMaster::showTop(char **topic_filter, int num_filters)
while
(
!
quit
)
{
#ifdef __PX4_QURT
if
(
++
num_runs
>
1
)
{
quit
=
true
;
//just exit after one output
}
#else
#ifndef __PX4_QURT
/* Sleep 200 ms waiting for user input five times ~ 1s */
for
(
int
k
=
0
;
k
<
5
;
k
++
)
{
...
...
@@ -362,6 +368,10 @@ void uORB::DeviceMaster::showTop(char **topic_filter, int num_filters)
addNewDeviceNodes
(
&
first_node
,
num_topics
,
max_topic_name_length
,
topic_filter
,
num_filters
);
unlock
();
}
if
(
only_once
)
{
quit
=
true
;
}
}
//cleanup
...
...
This diff is collapsed.
Click to expand it.
src/modules/uORB/uORBMain.cpp
+
1
−
0
View file @
509189ea
...
...
@@ -78,6 +78,7 @@ $ uorb top
PRINT_MODULE_USAGE_COMMAND_DESCR
(
"status"
,
"Print topic statistics"
);
PRINT_MODULE_USAGE_COMMAND_DESCR
(
"top"
,
"Monitor topic publication rates"
);
PRINT_MODULE_USAGE_PARAM_FLAG
(
'a'
,
"print all instead of only currently publishing topics"
,
true
);
PRINT_MODULE_USAGE_PARAM_FLAG
(
'1'
,
"run only once, then exit"
,
true
);
PRINT_MODULE_USAGE_ARG
(
"<filter1> [<filter2>]"
,
"topic(s) to match (implies -a)"
,
true
);
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment