AP_HAL_Linux: unify singleton naming to _singleton and get_singleton()

This commit is contained in:
Tom Pittenger 2019-02-10 10:30:07 -08:00 committed by Tom Pittenger
parent 81df9aaeb4
commit 95820c905d
3 changed files with 11 additions and 11 deletions

View File

@ -35,7 +35,7 @@ using namespace Linux;
static const AP_HAL::HAL &hal = AP_HAL::get_HAL(); static const AP_HAL::HAL &hal = AP_HAL::get_HAL();
Perf *Perf::_instance; Perf *Perf::_singleton;
static inline uint64_t now_nsec() static inline uint64_t now_nsec()
{ {
@ -44,13 +44,13 @@ static inline uint64_t now_nsec()
return ts.tv_nsec + (ts.tv_sec * AP_NSEC_PER_SEC); return ts.tv_nsec + (ts.tv_sec * AP_NSEC_PER_SEC);
} }
Perf *Perf::get_instance() Perf *Perf::get_singleton()
{ {
if (!_instance) { if (!_singleton) {
_instance = new Perf(); _singleton = new Perf();
} }
return _instance; return _singleton;
} }
void Perf::_debug_counters() void Perf::_debug_counters()

View File

@ -64,7 +64,7 @@ class Perf {
public: public:
~Perf(); ~Perf();
static Perf *get_instance(); static Perf *get_singleton();
perf_counter_t add(perf_counter_type type, const char *name); perf_counter_t add(perf_counter_type type, const char *name);
@ -75,7 +75,7 @@ public:
unsigned int get_update_count() { return _update_count; } unsigned int get_update_count() { return _update_count; }
private: private:
static Perf *_instance; static Perf *_singleton;
Perf(); Perf();

View File

@ -75,22 +75,22 @@ public:
perf_counter_t perf_alloc(enum perf_counter_type t, const char *name) override perf_counter_t perf_alloc(enum perf_counter_type t, const char *name) override
{ {
return Perf::get_instance()->add(t, name); return Perf::get_singleton()->add(t, name);
} }
void perf_begin(perf_counter_t perf) override void perf_begin(perf_counter_t perf) override
{ {
return Perf::get_instance()->begin(perf); return Perf::get_singleton()->begin(perf);
} }
void perf_end(perf_counter_t perf) override void perf_end(perf_counter_t perf) override
{ {
return Perf::get_instance()->end(perf); return Perf::get_singleton()->end(perf);
} }
void perf_count(perf_counter_t perf) override void perf_count(perf_counter_t perf) override
{ {
return Perf::get_instance()->count(perf); return Perf::get_singleton()->count(perf);
} }
int get_hw_arm32(); int get_hw_arm32();