land detector add cycle perf

This commit is contained in:
Daniel Agar
2017-08-31 22:49:44 -04:00
parent c250fb0a9e
commit cb8cc9a795
2 changed files with 10 additions and 3 deletions
+7 -3
View File
@@ -47,11 +47,9 @@
#include <drivers/drv_hrt.h>
#include "uORB/topics/parameter_update.h"
namespace land_detector
{
LandDetector::LandDetector() :
_landDetectedPub(nullptr),
_landDetected{0, false, false},
@@ -63,12 +61,14 @@ LandDetector::LandDetector() :
_ground_contact_hysteresis(true),
_total_flight_time{0},
_takeoff_time{0},
_work{}
_work{},
_cycle_perf(perf_alloc(PC_ELAPSED, "land_detector_cycle"))
{
}
LandDetector::~LandDetector()
{
perf_free(_cycle_perf);
}
int LandDetector::start()
@@ -87,6 +87,8 @@ LandDetector::_cycle_trampoline(void *arg)
void LandDetector::_cycle()
{
perf_begin(_cycle_perf);
if (!_object) { // not initialized yet
// Advertise the first land detected uORB.
_landDetected.timestamp = hrt_absolute_time();
@@ -155,6 +157,8 @@ void LandDetector::_cycle()
&instance, ORB_PRIO_DEFAULT);
}
perf_end(_cycle_perf);
if (!should_exit()) {
// Schedule next cycle.
+3
View File
@@ -46,6 +46,7 @@
#include <px4_module.h>
#include <systemlib/hysteresis/hysteresis.h>
#include <systemlib/param/param.h>
#include <systemlib/perf_counter.h>
#include <uORB/uORB.h>
#include <uORB/topics/vehicle_land_detected.h>
@@ -175,6 +176,8 @@ private:
hrt_abstime _takeoff_time;
struct work_s _work;
perf_counter_t _cycle_perf;
};