mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-10-28 23:33:33 +08:00
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:
@@ -39,7 +39,7 @@
|
||||
|
||||
ADIS16448::ADIS16448(int bus, uint32_t device, enum Rotation rotation) :
|
||||
SPI("ADIS16448", nullptr, bus, device, SPIDEV_MODE3, 1000000),
|
||||
ScheduledWorkItem(px4::device_bus_to_wq(get_device_id())),
|
||||
ScheduledWorkItem(MODULE_NAME, px4::device_bus_to_wq(get_device_id())),
|
||||
_px4_accel(get_device_id(), ORB_PRIO_MAX, rotation),
|
||||
_px4_baro(get_device_id(), ORB_PRIO_MAX),
|
||||
_px4_gyro(get_device_id(), ORB_PRIO_MAX, rotation),
|
||||
@@ -64,7 +64,6 @@ ADIS16448::~ADIS16448()
|
||||
|
||||
// Delete the perf counter.
|
||||
perf_free(_perf_read);
|
||||
perf_free(_perf_read_interval);
|
||||
perf_free(_perf_transfer);
|
||||
perf_free(_perf_bad_transfer);
|
||||
perf_free(_perf_crc_bad);
|
||||
@@ -314,7 +313,6 @@ void
|
||||
ADIS16448::print_info()
|
||||
{
|
||||
perf_print_counter(_perf_read);
|
||||
perf_print_counter(_perf_read_interval);
|
||||
perf_print_counter(_perf_transfer);
|
||||
perf_print_counter(_perf_bad_transfer);
|
||||
perf_print_counter(_perf_crc_bad);
|
||||
@@ -444,8 +442,6 @@ convert12BitToINT16(uint16_t word)
|
||||
int
|
||||
ADIS16448::measure()
|
||||
{
|
||||
perf_count(_perf_read_interval);
|
||||
|
||||
// Start measuring.
|
||||
perf_begin(_perf_read);
|
||||
|
||||
|
||||
@@ -211,7 +211,6 @@ private:
|
||||
static constexpr float _sample_rate{ADIS16448_ACCEL_GYRO_UPDATE_RATE};
|
||||
|
||||
perf_counter_t _perf_read{perf_counter_t(perf_alloc(PC_ELAPSED, "ADIS16448: read"))};
|
||||
perf_counter_t _perf_read_interval{perf_alloc(PC_INTERVAL, "ADIS16448: read interval")};
|
||||
perf_counter_t _perf_transfer{perf_counter_t(perf_alloc(PC_ELAPSED, "ADIS16448: transfer"))};
|
||||
perf_counter_t _perf_bad_transfer{perf_counter_t(perf_alloc(PC_COUNT, "ADIS16448: bad transfers"))};
|
||||
perf_counter_t _perf_crc_bad{perf_counter_t(perf_alloc(PC_COUNT, "ADIS16448: CRC16 bad"))};
|
||||
|
||||
@@ -55,10 +55,9 @@ using namespace time_literals;
|
||||
|
||||
ADIS16477::ADIS16477(int bus, uint32_t device, enum Rotation rotation) :
|
||||
SPI("ADIS16477", nullptr, bus, device, SPIDEV_MODE3, 1000000),
|
||||
ScheduledWorkItem(px4::device_bus_to_wq(get_device_id())),
|
||||
ScheduledWorkItem(MODULE_NAME, px4::device_bus_to_wq(get_device_id())),
|
||||
_px4_accel(get_device_id(), ORB_PRIO_MAX, rotation),
|
||||
_px4_gyro(get_device_id(), ORB_PRIO_MAX, rotation),
|
||||
_sample_interval_perf(perf_alloc(PC_INTERVAL, "adis16477: read interval")),
|
||||
_sample_perf(perf_alloc(PC_ELAPSED, "adis16477: read")),
|
||||
_bad_transfers(perf_alloc(PC_COUNT, "adis16477: bad transfers"))
|
||||
{
|
||||
@@ -82,7 +81,6 @@ ADIS16477::~ADIS16477()
|
||||
stop();
|
||||
|
||||
// delete the perf counters
|
||||
perf_free(_sample_interval_perf);
|
||||
perf_free(_sample_perf);
|
||||
perf_free(_bad_transfers);
|
||||
}
|
||||
@@ -321,7 +319,6 @@ ADIS16477::Run()
|
||||
int
|
||||
ADIS16477::measure()
|
||||
{
|
||||
perf_count(_sample_interval_perf);
|
||||
perf_begin(_sample_perf);
|
||||
|
||||
// Fetch the full set of measurements from the ADIS16477 in one pass (burst read).
|
||||
@@ -391,7 +388,6 @@ ADIS16477::measure()
|
||||
void
|
||||
ADIS16477::print_info()
|
||||
{
|
||||
perf_print_counter(_sample_interval_perf);
|
||||
perf_print_counter(_sample_perf);
|
||||
perf_print_counter(_bad_transfers);
|
||||
|
||||
|
||||
@@ -65,7 +65,6 @@ private:
|
||||
PX4Accelerometer _px4_accel;
|
||||
PX4Gyroscope _px4_gyro;
|
||||
|
||||
perf_counter_t _sample_interval_perf;
|
||||
perf_counter_t _sample_perf;
|
||||
perf_counter_t _bad_transfers;
|
||||
|
||||
|
||||
@@ -68,10 +68,9 @@ using namespace time_literals;
|
||||
|
||||
ADIS16497::ADIS16497(int bus, uint32_t device, enum Rotation rotation) :
|
||||
SPI("ADIS16497", nullptr, bus, device, SPIDEV_MODE3, 5000000),
|
||||
ScheduledWorkItem(px4::device_bus_to_wq(get_device_id())),
|
||||
ScheduledWorkItem(MODULE_NAME, px4::device_bus_to_wq(get_device_id())),
|
||||
_px4_accel(get_device_id(), ORB_PRIO_MAX, rotation),
|
||||
_px4_gyro(get_device_id(), ORB_PRIO_MAX, rotation),
|
||||
_sample_interval_perf(perf_alloc(PC_INTERVAL, "adis16497: read interval")),
|
||||
_sample_perf(perf_alloc(PC_ELAPSED, "adis16497: read")),
|
||||
_bad_transfers(perf_alloc(PC_COUNT, "adis16497: bad transfers"))
|
||||
{
|
||||
@@ -95,7 +94,6 @@ ADIS16497::~ADIS16497()
|
||||
stop();
|
||||
|
||||
// delete the perf counters
|
||||
perf_free(_sample_interval_perf);
|
||||
perf_free(_sample_perf);
|
||||
perf_free(_bad_transfers);
|
||||
}
|
||||
@@ -384,7 +382,6 @@ ADIS16497::Run()
|
||||
int
|
||||
ADIS16497::measure()
|
||||
{
|
||||
perf_count(_sample_interval_perf);
|
||||
perf_begin(_sample_perf);
|
||||
|
||||
// Fetch the full set of measurements from the ADIS16497 in one pass (burst read).
|
||||
@@ -468,7 +465,6 @@ ADIS16497::measure()
|
||||
void
|
||||
ADIS16497::print_info()
|
||||
{
|
||||
perf_print_counter(_sample_interval_perf);
|
||||
perf_print_counter(_sample_perf);
|
||||
perf_print_counter(_bad_transfers);
|
||||
|
||||
|
||||
@@ -101,7 +101,6 @@ private:
|
||||
PX4Accelerometer _px4_accel;
|
||||
PX4Gyroscope _px4_gyro;
|
||||
|
||||
perf_counter_t _sample_interval_perf;
|
||||
perf_counter_t _sample_perf;
|
||||
perf_counter_t _bad_transfers;
|
||||
|
||||
|
||||
@@ -223,7 +223,7 @@ private:
|
||||
|
||||
BMA180::BMA180(int bus, uint32_t device) :
|
||||
SPI("BMA180", ACCEL_DEVICE_PATH, bus, device, SPIDEV_MODE3, 8000000),
|
||||
ScheduledWorkItem(px4::device_bus_to_wq(this->get_device_id())),
|
||||
ScheduledWorkItem(MODULE_NAME, px4::device_bus_to_wq(this->get_device_id())),
|
||||
_call_interval(0),
|
||||
_reports(nullptr),
|
||||
_accel_range_scale(0.0f),
|
||||
|
||||
@@ -46,10 +46,9 @@ const uint8_t BMI055_accel::_checked_registers[BMI055_ACCEL_NUM_CHECKED_REGISTER
|
||||
|
||||
BMI055_accel::BMI055_accel(int bus, const char *path_accel, uint32_t device, enum Rotation rotation) :
|
||||
BMI055("BMI055_ACCEL", path_accel, bus, device, SPIDEV_MODE3, BMI055_BUS_SPEED, rotation),
|
||||
ScheduledWorkItem(px4::device_bus_to_wq(get_device_id())),
|
||||
ScheduledWorkItem(MODULE_NAME, px4::device_bus_to_wq(get_device_id())),
|
||||
_px4_accel(get_device_id(), (external() ? ORB_PRIO_MAX - 1 : ORB_PRIO_HIGH - 1), rotation),
|
||||
_sample_perf(perf_alloc(PC_ELAPSED, "bmi055_accel_read")),
|
||||
_measure_interval(perf_alloc(PC_INTERVAL, "bmi055_accel_measure_interval")),
|
||||
_bad_transfers(perf_alloc(PC_COUNT, "bmi055_accel_bad_transfers")),
|
||||
_bad_registers(perf_alloc(PC_COUNT, "bmi055_accel_bad_registers")),
|
||||
_duplicates(perf_alloc(PC_COUNT, "bmi055_accel_duplicates")),
|
||||
@@ -65,7 +64,6 @@ BMI055_accel::~BMI055_accel()
|
||||
|
||||
/* delete the perf counter */
|
||||
perf_free(_sample_perf);
|
||||
perf_free(_measure_interval);
|
||||
perf_free(_bad_transfers);
|
||||
perf_free(_bad_registers);
|
||||
perf_free(_duplicates);
|
||||
@@ -286,8 +284,6 @@ BMI055_accel::check_registers(void)
|
||||
void
|
||||
BMI055_accel::measure()
|
||||
{
|
||||
perf_count(_measure_interval);
|
||||
|
||||
if (hrt_absolute_time() < _reset_wait) {
|
||||
// we're waiting for a reset to complete
|
||||
return;
|
||||
@@ -409,7 +405,6 @@ void
|
||||
BMI055_accel::print_info()
|
||||
{
|
||||
perf_print_counter(_sample_perf);
|
||||
perf_print_counter(_measure_interval);
|
||||
perf_print_counter(_bad_transfers);
|
||||
perf_print_counter(_bad_registers);
|
||||
perf_print_counter(_duplicates);
|
||||
|
||||
@@ -169,7 +169,6 @@ private:
|
||||
PX4Accelerometer _px4_accel;
|
||||
|
||||
perf_counter_t _sample_perf;
|
||||
perf_counter_t _measure_interval;
|
||||
perf_counter_t _bad_transfers;
|
||||
perf_counter_t _bad_registers;
|
||||
perf_counter_t _duplicates;
|
||||
|
||||
@@ -49,10 +49,9 @@ const uint8_t BMI055_gyro::_checked_registers[BMI055_GYRO_NUM_CHECKED_REGISTERS]
|
||||
|
||||
BMI055_gyro::BMI055_gyro(int bus, const char *path_gyro, uint32_t device, enum Rotation rotation) :
|
||||
BMI055("BMI055_GYRO", path_gyro, bus, device, SPIDEV_MODE3, BMI055_BUS_SPEED, rotation),
|
||||
ScheduledWorkItem(px4::device_bus_to_wq(get_device_id())),
|
||||
ScheduledWorkItem(MODULE_NAME, px4::device_bus_to_wq(get_device_id())),
|
||||
_px4_gyro(get_device_id(), (external() ? ORB_PRIO_MAX - 1 : ORB_PRIO_HIGH - 1), rotation),
|
||||
_sample_perf(perf_alloc(PC_ELAPSED, "bmi055_gyro_read")),
|
||||
_measure_interval(perf_alloc(PC_INTERVAL, "bmi055_gyro_measure_interval")),
|
||||
_bad_transfers(perf_alloc(PC_COUNT, "bmi055_gyro_bad_transfers")),
|
||||
_bad_registers(perf_alloc(PC_COUNT, "bmi055_gyro_bad_registers"))
|
||||
{
|
||||
@@ -66,7 +65,6 @@ BMI055_gyro::~BMI055_gyro()
|
||||
|
||||
/* delete the perf counter */
|
||||
perf_free(_sample_perf);
|
||||
perf_free(_measure_interval);
|
||||
perf_free(_bad_transfers);
|
||||
perf_free(_bad_registers);
|
||||
}
|
||||
@@ -322,8 +320,6 @@ BMI055_gyro::check_registers(void)
|
||||
void
|
||||
BMI055_gyro::measure()
|
||||
{
|
||||
perf_count(_measure_interval);
|
||||
|
||||
if (hrt_absolute_time() < _reset_wait) {
|
||||
// we're waiting for a reset to complete
|
||||
return;
|
||||
@@ -421,7 +417,6 @@ BMI055_gyro::print_info()
|
||||
PX4_INFO("Gyro");
|
||||
|
||||
perf_print_counter(_sample_perf);
|
||||
perf_print_counter(_measure_interval);
|
||||
perf_print_counter(_bad_transfers);
|
||||
perf_print_counter(_bad_registers);
|
||||
|
||||
|
||||
@@ -161,7 +161,6 @@ private:
|
||||
PX4Gyroscope _px4_gyro;
|
||||
|
||||
perf_counter_t _sample_perf;
|
||||
perf_counter_t _measure_interval;
|
||||
perf_counter_t _bad_transfers;
|
||||
perf_counter_t _bad_registers;
|
||||
|
||||
|
||||
@@ -54,10 +54,9 @@ const uint8_t BMI088_accel::_checked_registers[BMI088_ACCEL_NUM_CHECKED_REGISTER
|
||||
|
||||
BMI088_accel::BMI088_accel(int bus, const char *path_accel, uint32_t device, enum Rotation rotation) :
|
||||
BMI088("BMI088_ACCEL", path_accel, bus, device, SPIDEV_MODE3, BMI088_BUS_SPEED, rotation),
|
||||
ScheduledWorkItem(px4::device_bus_to_wq(get_device_id())),
|
||||
ScheduledWorkItem(MODULE_NAME, px4::device_bus_to_wq(get_device_id())),
|
||||
_px4_accel(get_device_id(), (external() ? ORB_PRIO_MAX - 1 : ORB_PRIO_HIGH - 1), rotation),
|
||||
_sample_perf(perf_alloc(PC_ELAPSED, "bmi088_accel_read")),
|
||||
_measure_interval(perf_alloc(PC_INTERVAL, "bmi088_accel_measure_interval")),
|
||||
_bad_transfers(perf_alloc(PC_COUNT, "bmi088_accel_bad_transfers")),
|
||||
_bad_registers(perf_alloc(PC_COUNT, "bmi088_accel_bad_registers")),
|
||||
_duplicates(perf_alloc(PC_COUNT, "bmi088_accel_duplicates")),
|
||||
@@ -73,7 +72,6 @@ BMI088_accel::~BMI088_accel()
|
||||
|
||||
/* delete the perf counter */
|
||||
perf_free(_sample_perf);
|
||||
perf_free(_measure_interval);
|
||||
perf_free(_bad_transfers);
|
||||
perf_free(_bad_registers);
|
||||
perf_free(_duplicates);
|
||||
@@ -398,8 +396,6 @@ BMI088_accel::check_registers(void)
|
||||
void
|
||||
BMI088_accel::measure()
|
||||
{
|
||||
perf_count(_measure_interval);
|
||||
|
||||
if (hrt_absolute_time() < _reset_wait) {
|
||||
// we're waiting for a reset to complete
|
||||
return;
|
||||
@@ -539,7 +535,6 @@ BMI088_accel::print_info()
|
||||
PX4_INFO("Accel");
|
||||
|
||||
perf_print_counter(_sample_perf);
|
||||
perf_print_counter(_measure_interval);
|
||||
perf_print_counter(_bad_transfers);
|
||||
perf_print_counter(_bad_registers);
|
||||
perf_print_counter(_duplicates);
|
||||
|
||||
@@ -190,7 +190,6 @@ private:
|
||||
PX4Accelerometer _px4_accel;
|
||||
|
||||
perf_counter_t _sample_perf;
|
||||
perf_counter_t _measure_interval;
|
||||
perf_counter_t _bad_transfers;
|
||||
perf_counter_t _bad_registers;
|
||||
perf_counter_t _duplicates;
|
||||
|
||||
@@ -57,10 +57,9 @@ const uint8_t BMI088_gyro::_checked_registers[BMI088_GYRO_NUM_CHECKED_REGISTERS]
|
||||
|
||||
BMI088_gyro::BMI088_gyro(int bus, const char *path_gyro, uint32_t device, enum Rotation rotation) :
|
||||
BMI088("BMI088_GYRO", path_gyro, bus, device, SPIDEV_MODE3, BMI088_BUS_SPEED, rotation),
|
||||
ScheduledWorkItem(px4::device_bus_to_wq(get_device_id())),
|
||||
ScheduledWorkItem(MODULE_NAME, px4::device_bus_to_wq(get_device_id())),
|
||||
_px4_gyro(get_device_id(), (external() ? ORB_PRIO_MAX - 1 : ORB_PRIO_HIGH - 1), rotation),
|
||||
_sample_perf(perf_alloc(PC_ELAPSED, "bmi088_gyro_read")),
|
||||
_measure_interval(perf_alloc(PC_INTERVAL, "bmi088_gyro_measure_interval")),
|
||||
_bad_transfers(perf_alloc(PC_COUNT, "bmi088_gyro_bad_transfers")),
|
||||
_bad_registers(perf_alloc(PC_COUNT, "bmi088_gyro_bad_registers"))
|
||||
{
|
||||
@@ -74,7 +73,6 @@ BMI088_gyro::~BMI088_gyro()
|
||||
|
||||
/* delete the perf counter */
|
||||
perf_free(_sample_perf);
|
||||
perf_free(_measure_interval);
|
||||
perf_free(_bad_transfers);
|
||||
perf_free(_bad_registers);
|
||||
}
|
||||
@@ -340,8 +338,6 @@ BMI088_gyro::check_registers(void)
|
||||
void
|
||||
BMI088_gyro::measure()
|
||||
{
|
||||
perf_count(_measure_interval);
|
||||
|
||||
if (hrt_absolute_time() < _reset_wait) {
|
||||
// we're waiting for a reset to complete
|
||||
return;
|
||||
@@ -435,7 +431,6 @@ BMI088_gyro::print_info()
|
||||
PX4_INFO("Gyro");
|
||||
|
||||
perf_print_counter(_sample_perf);
|
||||
perf_print_counter(_measure_interval);
|
||||
perf_print_counter(_bad_transfers);
|
||||
perf_print_counter(_bad_registers);
|
||||
|
||||
|
||||
@@ -159,7 +159,6 @@ private:
|
||||
PX4Gyroscope _px4_gyro;
|
||||
|
||||
perf_counter_t _sample_perf;
|
||||
perf_counter_t _measure_interval;
|
||||
perf_counter_t _bad_transfers;
|
||||
perf_counter_t _bad_registers;
|
||||
|
||||
|
||||
@@ -51,7 +51,7 @@ const uint8_t BMI160::_checked_registers[BMI160_NUM_CHECKED_REGISTERS] = { BM
|
||||
|
||||
BMI160::BMI160(int bus, uint32_t device, enum Rotation rotation) :
|
||||
SPI("BMI160", nullptr, bus, device, SPIDEV_MODE3, BMI160_BUS_SPEED),
|
||||
ScheduledWorkItem(px4::device_bus_to_wq(this->get_device_id())),
|
||||
ScheduledWorkItem(MODULE_NAME, px4::device_bus_to_wq(this->get_device_id())),
|
||||
_px4_accel(get_device_id(), (external() ? ORB_PRIO_MAX - 1 : ORB_PRIO_HIGH - 1), rotation),
|
||||
_px4_gyro(get_device_id(), (external() ? ORB_PRIO_MAX - 1 : ORB_PRIO_HIGH - 1), rotation),
|
||||
_accel_reads(perf_alloc(PC_COUNT, "bmi160_accel_read")),
|
||||
|
||||
@@ -188,10 +188,9 @@ using namespace time_literals;
|
||||
|
||||
FXAS21002C::FXAS21002C(int bus, uint32_t device, enum Rotation rotation) :
|
||||
SPI("FXAS21002C", nullptr, bus, device, SPIDEV_MODE0, 2 * 1000 * 1000),
|
||||
ScheduledWorkItem(px4::device_bus_to_wq(this->get_device_id())),
|
||||
ScheduledWorkItem(MODULE_NAME, px4::device_bus_to_wq(this->get_device_id())),
|
||||
_px4_gyro(get_device_id(), (external() ? ORB_PRIO_VERY_HIGH : ORB_PRIO_DEFAULT), rotation),
|
||||
_sample_perf(perf_alloc(PC_ELAPSED, MODULE_NAME": read")),
|
||||
_sample_interval_perf(perf_alloc(PC_INTERVAL, MODULE_NAME": read interval")),
|
||||
_errors(perf_alloc(PC_COUNT, MODULE_NAME": err")),
|
||||
_bad_registers(perf_alloc(PC_COUNT, MODULE_NAME": bad register")),
|
||||
_duplicates(perf_alloc(PC_COUNT, MODULE_NAME": duplicate reading"))
|
||||
@@ -206,7 +205,6 @@ FXAS21002C::~FXAS21002C()
|
||||
|
||||
/* delete the perf counter */
|
||||
perf_free(_sample_perf);
|
||||
perf_free(_sample_interval_perf);
|
||||
perf_free(_errors);
|
||||
perf_free(_bad_registers);
|
||||
perf_free(_duplicates);
|
||||
@@ -530,7 +528,6 @@ FXAS21002C::measure()
|
||||
{
|
||||
// start the performance counter
|
||||
perf_begin(_sample_perf);
|
||||
perf_count(_sample_interval_perf);
|
||||
|
||||
/* status register and data as read back from the device */
|
||||
#pragma pack(push, 1)
|
||||
@@ -598,7 +595,6 @@ FXAS21002C::print_info()
|
||||
{
|
||||
printf("gyro reads: %u\n", _read);
|
||||
perf_print_counter(_sample_perf);
|
||||
perf_print_counter(_sample_interval_perf);
|
||||
perf_print_counter(_errors);
|
||||
perf_print_counter(_bad_registers);
|
||||
perf_print_counter(_duplicates);
|
||||
|
||||
@@ -81,7 +81,6 @@ private:
|
||||
unsigned _read{0};
|
||||
|
||||
perf_counter_t _sample_perf;
|
||||
perf_counter_t _sample_interval_perf;
|
||||
perf_counter_t _errors;
|
||||
perf_counter_t _bad_registers;
|
||||
perf_counter_t _duplicates;
|
||||
|
||||
@@ -55,14 +55,13 @@ const uint8_t FXOS8701CQ::_checked_registers[FXOS8701C_NUM_CHECKED_REGISTERS] =
|
||||
|
||||
FXOS8701CQ::FXOS8701CQ(int bus, uint32_t device, enum Rotation rotation) :
|
||||
SPI("FXOS8701CQ", nullptr, bus, device, SPIDEV_MODE0, 1 * 1000 * 1000),
|
||||
ScheduledWorkItem(px4::device_bus_to_wq(get_device_id())),
|
||||
ScheduledWorkItem(MODULE_NAME, px4::device_bus_to_wq(get_device_id())),
|
||||
_px4_accel(get_device_id(), ORB_PRIO_LOW, rotation),
|
||||
#if !defined(BOARD_HAS_NOISY_FXOS8700_MAG)
|
||||
_px4_mag(get_device_id(), ORB_PRIO_LOW, rotation),
|
||||
_mag_sample_perf(perf_alloc(PC_ELAPSED, MODULE_NAME": mag read")),
|
||||
#endif
|
||||
_accel_sample_perf(perf_alloc(PC_ELAPSED, MODULE_NAME": acc read")),
|
||||
_accel_sample_interval_perf(perf_alloc(PC_INTERVAL, MODULE_NAME": acc read interval")),
|
||||
_bad_registers(perf_alloc(PC_COUNT, MODULE_NAME": bad reg")),
|
||||
_accel_duplicates(perf_alloc(PC_COUNT, MODULE_NAME": acc dupe"))
|
||||
{
|
||||
@@ -87,7 +86,6 @@ FXOS8701CQ::~FXOS8701CQ()
|
||||
|
||||
// delete the perf counter
|
||||
perf_free(_accel_sample_perf);
|
||||
perf_free(_accel_sample_interval_perf);
|
||||
perf_free(_bad_registers);
|
||||
perf_free(_accel_duplicates);
|
||||
}
|
||||
@@ -334,7 +332,6 @@ FXOS8701CQ::Run()
|
||||
{
|
||||
// start the performance counter
|
||||
perf_begin(_accel_sample_perf);
|
||||
perf_count(_accel_sample_interval_perf);
|
||||
|
||||
// status register and data as read back from the device
|
||||
#pragma pack(push, 1)
|
||||
@@ -413,7 +410,6 @@ void
|
||||
FXOS8701CQ::print_info()
|
||||
{
|
||||
perf_print_counter(_accel_sample_perf);
|
||||
perf_print_counter(_accel_sample_interval_perf);
|
||||
|
||||
#if !defined(BOARD_HAS_NOISY_FXOS8700_MAG)
|
||||
perf_print_counter(_mag_sample_perf);
|
||||
|
||||
@@ -214,7 +214,6 @@ private:
|
||||
unsigned _accel_samplerate{FXOS8701C_ACCEL_DEFAULT_RATE};
|
||||
|
||||
perf_counter_t _accel_sample_perf;
|
||||
perf_counter_t _accel_sample_interval_perf;
|
||||
perf_counter_t _bad_registers;
|
||||
perf_counter_t _accel_duplicates;
|
||||
|
||||
|
||||
@@ -86,7 +86,7 @@ const uint16_t ICM20948::_icm20948_checked_registers[ICM20948_NUM_CHECKED_REGIST
|
||||
|
||||
ICM20948::ICM20948(device::Device *interface, device::Device *mag_interface, const char *path, enum Rotation rotation,
|
||||
bool magnetometer_only) :
|
||||
ScheduledWorkItem(px4::device_bus_to_wq(interface->get_device_id())),
|
||||
ScheduledWorkItem(MODULE_NAME, px4::device_bus_to_wq(interface->get_device_id())),
|
||||
_interface(interface),
|
||||
_px4_accel(_interface->get_device_id(), (_interface->external() ? ORB_PRIO_DEFAULT : ORB_PRIO_HIGH), rotation),
|
||||
_px4_gyro(_interface->get_device_id(), (_interface->external() ? ORB_PRIO_DEFAULT : ORB_PRIO_HIGH), rotation),
|
||||
|
||||
@@ -322,7 +322,7 @@ constexpr uint8_t L3GD20::_checked_registers[];
|
||||
|
||||
L3GD20::L3GD20(int bus, const char *path, uint32_t device, enum Rotation rotation) :
|
||||
SPI("L3GD20", path, bus, device, SPIDEV_MODE3, 11 * 1000 * 1000),
|
||||
ScheduledWorkItem(px4::device_bus_to_wq(this->get_device_id())),
|
||||
ScheduledWorkItem(MODULE_NAME, px4::device_bus_to_wq(this->get_device_id())),
|
||||
_px4_gyro(get_device_id(), ORB_PRIO_DEFAULT, rotation),
|
||||
_sample_perf(perf_alloc(PC_ELAPSED, "l3gd20_read")),
|
||||
_errors(perf_alloc(PC_COUNT, "l3gd20_err")),
|
||||
|
||||
@@ -55,13 +55,11 @@ static constexpr uint8_t _checked_registers[] = {
|
||||
|
||||
LSM303D::LSM303D(int bus, uint32_t device, enum Rotation rotation) :
|
||||
SPI("LSM303D", nullptr, bus, device, SPIDEV_MODE3, 11 * 1000 * 1000),
|
||||
ScheduledWorkItem(px4::device_bus_to_wq(get_device_id())),
|
||||
ScheduledWorkItem(MODULE_NAME, px4::device_bus_to_wq(get_device_id())),
|
||||
_px4_accel(get_device_id(), ORB_PRIO_DEFAULT, rotation),
|
||||
_px4_mag(get_device_id(), ORB_PRIO_LOW, rotation),
|
||||
_accel_sample_perf(perf_alloc(PC_ELAPSED, "lsm303d: acc_read")),
|
||||
_accel_sample_interval_perf(perf_alloc(PC_INTERVAL, "lsm303d: acc interval")),
|
||||
_mag_sample_perf(perf_alloc(PC_ELAPSED, "lsm303d: mag_read")),
|
||||
_mag_sample_interval_perf(perf_alloc(PC_INTERVAL, "lsm303d: mag interval")),
|
||||
_bad_registers(perf_alloc(PC_COUNT, "lsm303d: bad_reg")),
|
||||
_bad_values(perf_alloc(PC_COUNT, "lsm303d: bad_val")),
|
||||
_accel_duplicates(perf_alloc(PC_COUNT, "lsm303d: acc_dupe"))
|
||||
@@ -78,9 +76,7 @@ LSM303D::~LSM303D()
|
||||
|
||||
// delete the perf counter
|
||||
perf_free(_accel_sample_perf);
|
||||
perf_free(_accel_sample_interval_perf);
|
||||
perf_free(_mag_sample_perf);
|
||||
perf_free(_mag_sample_interval_perf);
|
||||
perf_free(_bad_registers);
|
||||
perf_free(_bad_values);
|
||||
perf_free(_accel_duplicates);
|
||||
@@ -470,7 +466,6 @@ void
|
||||
LSM303D::measureAccelerometer()
|
||||
{
|
||||
perf_begin(_accel_sample_perf);
|
||||
perf_count(_accel_sample_interval_perf);
|
||||
|
||||
// status register and data as read back from the device
|
||||
#pragma pack(push, 1)
|
||||
@@ -552,7 +547,6 @@ void
|
||||
LSM303D::measureMagnetometer()
|
||||
{
|
||||
perf_begin(_mag_sample_perf);
|
||||
perf_count(_mag_sample_interval_perf);
|
||||
|
||||
// status register and data as read back from the device
|
||||
#pragma pack(push, 1)
|
||||
@@ -591,9 +585,7 @@ void
|
||||
LSM303D::print_info()
|
||||
{
|
||||
perf_print_counter(_accel_sample_perf);
|
||||
perf_print_counter(_accel_sample_interval_perf);
|
||||
perf_print_counter(_mag_sample_perf);
|
||||
perf_print_counter(_mag_sample_interval_perf);
|
||||
perf_print_counter(_bad_registers);
|
||||
perf_print_counter(_bad_values);
|
||||
perf_print_counter(_accel_duplicates);
|
||||
|
||||
@@ -274,9 +274,7 @@ private:
|
||||
unsigned _call_mag_interval{1000000 / LSM303D_MAG_DEFAULT_RATE};
|
||||
|
||||
perf_counter_t _accel_sample_perf;
|
||||
perf_counter_t _accel_sample_interval_perf;
|
||||
perf_counter_t _mag_sample_perf;
|
||||
perf_counter_t _mag_sample_interval_perf;
|
||||
perf_counter_t _bad_registers;
|
||||
perf_counter_t _bad_values;
|
||||
perf_counter_t _accel_duplicates;
|
||||
|
||||
@@ -41,13 +41,12 @@ constexpr uint8_t MPU6000::_checked_registers[MPU6000_NUM_CHECKED_REGISTERS];
|
||||
|
||||
MPU6000::MPU6000(device::Device *interface, const char *path, enum Rotation rotation, int device_type) :
|
||||
CDev(path),
|
||||
ScheduledWorkItem(px4::device_bus_to_wq(interface->get_device_id())),
|
||||
ScheduledWorkItem(MODULE_NAME, px4::device_bus_to_wq(interface->get_device_id())),
|
||||
_interface(interface),
|
||||
_device_type(device_type),
|
||||
_px4_accel(_interface->get_device_id(), (_interface->external() ? ORB_PRIO_MAX : ORB_PRIO_HIGH), rotation),
|
||||
_px4_gyro(_interface->get_device_id(), (_interface->external() ? ORB_PRIO_MAX : ORB_PRIO_HIGH), rotation),
|
||||
_sample_perf(perf_alloc(PC_ELAPSED, "mpu6k_read")),
|
||||
_measure_interval(perf_alloc(PC_INTERVAL, "mpu6k_measure_interval")),
|
||||
_bad_transfers(perf_alloc(PC_COUNT, "mpu6k_bad_trans")),
|
||||
_bad_registers(perf_alloc(PC_COUNT, "mpu6k_bad_reg")),
|
||||
_reset_retries(perf_alloc(PC_COUNT, "mpu6k_reset")),
|
||||
@@ -84,7 +83,6 @@ MPU6000::~MPU6000()
|
||||
|
||||
/* delete the perf counter */
|
||||
perf_free(_sample_perf);
|
||||
perf_free(_measure_interval);
|
||||
perf_free(_bad_transfers);
|
||||
perf_free(_bad_registers);
|
||||
perf_free(_reset_retries);
|
||||
@@ -729,8 +727,6 @@ MPU6000::check_registers(void)
|
||||
int
|
||||
MPU6000::measure()
|
||||
{
|
||||
perf_count(_measure_interval);
|
||||
|
||||
if (_in_factory_test) {
|
||||
// don't publish any data while in factory test mode
|
||||
return OK;
|
||||
@@ -897,7 +893,6 @@ void
|
||||
MPU6000::print_info()
|
||||
{
|
||||
perf_print_counter(_sample_perf);
|
||||
perf_print_counter(_measure_interval);
|
||||
perf_print_counter(_bad_transfers);
|
||||
perf_print_counter(_bad_registers);
|
||||
perf_print_counter(_reset_retries);
|
||||
|
||||
@@ -358,7 +358,6 @@ private:
|
||||
unsigned _sample_rate{1000};
|
||||
|
||||
perf_counter_t _sample_perf;
|
||||
perf_counter_t _measure_interval;
|
||||
perf_counter_t _bad_transfers;
|
||||
perf_counter_t _bad_registers;
|
||||
perf_counter_t _reset_retries;
|
||||
|
||||
@@ -72,7 +72,7 @@ const uint16_t MPU9250::_mpu9250_checked_registers[MPU9250_NUM_CHECKED_REGISTERS
|
||||
|
||||
MPU9250::MPU9250(device::Device *interface, device::Device *mag_interface, const char *path, enum Rotation rotation,
|
||||
bool magnetometer_only) :
|
||||
ScheduledWorkItem(px4::device_bus_to_wq(interface->get_device_id())),
|
||||
ScheduledWorkItem(MODULE_NAME, px4::device_bus_to_wq(interface->get_device_id())),
|
||||
_interface(interface),
|
||||
_px4_accel(_interface->get_device_id(), (_interface->external() ? ORB_PRIO_MAX : ORB_PRIO_HIGH), rotation),
|
||||
_px4_gyro(_interface->get_device_id(), (_interface->external() ? ORB_PRIO_MAX : ORB_PRIO_HIGH), rotation),
|
||||
|
||||
Reference in New Issue
Block a user