bmi055 add measure interval perf counter

This commit is contained in:
Daniel Agar
2018-07-07 11:17:46 -04:00
committed by Lorenz Meier
parent 0da8125ac0
commit e4be8eccc9
4 changed files with 12 additions and 0 deletions
+5
View File
@@ -49,6 +49,7 @@ 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),
_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")),
@@ -96,6 +97,7 @@ 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);
@@ -637,6 +639,8 @@ BMI055_accel::check_registers(void)
void
BMI055_accel::measure()
{
perf_count(_measure_interval);
uint8_t index = 0, accel_data[7];
uint16_t lsb, msb, msblsb;
uint8_t status_x, status_y, status_z;
@@ -805,6 +809,7 @@ BMI055_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);
+1
View File
@@ -176,6 +176,7 @@ protected:
private:
perf_counter_t _sample_perf;
perf_counter_t _measure_interval;
perf_counter_t _bad_transfers;
perf_counter_t _bad_registers;
perf_counter_t _duplicates;
+5
View File
@@ -50,6 +50,7 @@ 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),
_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")),
_gyro_reports(nullptr),
@@ -95,6 +96,7 @@ BMI055_gyro::~BMI055_gyro()
/* delete the perf counter */
perf_free(_sample_perf);
perf_free(_measure_interval);
perf_free(_bad_transfers);
perf_free(_bad_registers);
}
@@ -637,6 +639,8 @@ 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;
@@ -779,6 +783,7 @@ 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);
+1
View File
@@ -168,6 +168,7 @@ protected:
private:
perf_counter_t _sample_perf;
perf_counter_t _measure_interval;
perf_counter_t _bad_transfers;
perf_counter_t _bad_registers;