land detector add cycle perf

This commit is contained in:
Daniel Agar
2017-08-15 11:12:26 -04:00
parent c250fb0a9e
commit cb8cc9a795
2 changed files with 10 additions and 3 deletions

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.