Browse Source

AP_HAL_Linux: unify singleton naming to _singleton and get_singleton()

master
Tom Pittenger 6 years ago committed by Tom Pittenger
parent
commit
95820c905d
  1. 10
      libraries/AP_HAL_Linux/Perf.cpp
  2. 4
      libraries/AP_HAL_Linux/Perf.h
  3. 8
      libraries/AP_HAL_Linux/Util.h

10
libraries/AP_HAL_Linux/Perf.cpp

@ -35,7 +35,7 @@ using namespace Linux; @@ -35,7 +35,7 @@ using namespace Linux;
static const AP_HAL::HAL &hal = AP_HAL::get_HAL();
Perf *Perf::_instance;
Perf *Perf::_singleton;
static inline uint64_t now_nsec()
{
@ -44,13 +44,13 @@ 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);
}
Perf *Perf::get_instance()
Perf *Perf::get_singleton()
{
if (!_instance) {
_instance = new Perf();
if (!_singleton) {
_singleton = new Perf();
}
return _instance;
return _singleton;
}
void Perf::_debug_counters()

4
libraries/AP_HAL_Linux/Perf.h

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

8
libraries/AP_HAL_Linux/Util.h

@ -75,22 +75,22 @@ public: @@ -75,22 +75,22 @@ public:
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
{
return Perf::get_instance()->begin(perf);
return Perf::get_singleton()->begin(perf);
}
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
{
return Perf::get_instance()->count(perf);
return Perf::get_singleton()->count(perf);
}
int get_hw_arm32();

Loading…
Cancel
Save