px4_work_queue: command line status output and shutdown empty queues

* adds a work_queue systemcmd that will bring a tree view of all active work queues and work items
 * WorkQueues now track attached WorkItems and will shutdown when the last WorkItem is detached
This commit is contained in:
Daniel Agar
2019-10-02 12:23:17 -04:00
committed by GitHub
parent cc1d86bc0b
commit 26364d44c9
167 changed files with 582 additions and 274 deletions
+1 -6
View File
@@ -35,9 +35,8 @@
PAW3902::PAW3902(int bus, enum Rotation yaw_rotation) :
SPI("PAW3902", nullptr, bus, PAW3902_SPIDEV, SPIDEV_MODE0, PAW3902_SPI_BUS_SPEED),
ScheduledWorkItem(px4::device_bus_to_wq(get_device_id())),
ScheduledWorkItem(MODULE_NAME, px4::device_bus_to_wq(get_device_id())),
_sample_perf(perf_alloc(PC_ELAPSED, "paw3902: read")),
_interval_perf(perf_alloc(PC_INTERVAL, "paw3902: interval")),
_comms_errors(perf_alloc(PC_COUNT, "paw3902: com_err")),
_dupe_count_perf(perf_alloc(PC_COUNT, "paw3902: duplicate reading")),
_yaw_rotation(yaw_rotation)
@@ -51,12 +50,10 @@ PAW3902::~PAW3902()
// free perf counters
perf_free(_sample_perf);
perf_free(_interval_perf);
perf_free(_comms_errors);
perf_free(_dupe_count_perf);
}
int
PAW3902::init()
{
@@ -540,7 +537,6 @@ void
PAW3902::Run()
{
perf_begin(_sample_perf);
perf_count(_interval_perf);
struct TransferBuffer {
uint8_t cmd = Register::Motion_Burst;
@@ -699,7 +695,6 @@ void
PAW3902::print_info()
{
perf_print_counter(_sample_perf);
perf_print_counter(_interval_perf);
perf_print_counter(_comms_errors);
perf_print_counter(_dupe_count_perf);
}
@@ -120,7 +120,6 @@ private:
uORB::PublicationMulti<optical_flow_s> _optical_flow_pub{ORB_ID(optical_flow)};
perf_counter_t _sample_perf;
perf_counter_t _interval_perf;
perf_counter_t _comms_errors;
perf_counter_t _dupe_count_perf;
+1 -1
View File
@@ -37,7 +37,7 @@ static constexpr uint32_t TIME_us_TSWW = 11; // - actually 10.5us
PMW3901::PMW3901(int bus, enum Rotation yaw_rotation) :
SPI("PMW3901", PMW3901_DEVICE_PATH, bus, PMW3901_SPIDEV, SPIDEV_MODE0, PMW3901_SPI_BUS_SPEED),
ScheduledWorkItem(px4::device_bus_to_wq(get_device_id())),
ScheduledWorkItem(MODULE_NAME, px4::device_bus_to_wq(get_device_id())),
_sample_perf(perf_alloc(PC_ELAPSED, "pmw3901: read")),
_comms_errors(perf_alloc(PC_COUNT, "pmw3901: com err")),
_yaw_rotation(yaw_rotation)
+1 -1
View File
@@ -153,7 +153,7 @@ extern "C" __EXPORT int px4flow_main(int argc, char *argv[]);
PX4FLOW::PX4FLOW(int bus, int address, enum Rotation rotation, int conversion_interval, uint8_t sonar_rotation) :
I2C("PX4FLOW", PX4FLOW0_DEVICE_PATH, bus, address, PX4FLOW_I2C_MAX_BUS_SPEED), /* 100-400 KHz */
ScheduledWorkItem(px4::device_bus_to_wq(get_device_id())),
ScheduledWorkItem(MODULE_NAME, px4::device_bus_to_wq(get_device_id())),
_sonar_rotation(sonar_rotation),
_sample_perf(perf_alloc(PC_ELAPSED, "px4f_read")),
_comms_errors(perf_alloc(PC_COUNT, "px4f_com_err")),