diff options
author | moneromooo-monero <moneromooo-monero@users.noreply.github.com> | 2018-11-11 21:34:37 +0000 |
---|---|---|
committer | moneromooo-monero <moneromooo-monero@users.noreply.github.com> | 2018-11-27 13:55:21 +0000 |
commit | 721aacd88e780b30416deb66a68b87da8fe244ae (patch) | |
tree | 720cabb6fcd8c55ea018d4c6dc06a9a87631856d /external/easylogging++ | |
parent | Revert "easylogging++: make the logger handle early/late logging" (diff) | |
download | monero-721aacd88e780b30416deb66a68b87da8fe244ae.tar.xz |
easylogging++: faster access to logging
Turns out getting the global shared_ptr hits the profile,
and passing it around still keeps it at close to ~1% CPU,
which is too much for mostly silent logging.
Leak the object instead, which is even safer for late logging.
Diffstat (limited to 'external/easylogging++')
-rw-r--r-- | external/easylogging++/easylogging++.cc | 6 | ||||
-rw-r--r-- | external/easylogging++/easylogging++.h | 6 |
2 files changed, 10 insertions, 2 deletions
diff --git a/external/easylogging++/easylogging++.cc b/external/easylogging++/easylogging++.cc index 81179b0a3..c24fb80cf 100644 --- a/external/easylogging++/easylogging++.cc +++ b/external/easylogging++/easylogging++.cc @@ -2191,6 +2191,12 @@ void VRegistry::setFromArgs(const base::utils::CommandLineArgs* commandLineArgs) # define ELPP_DEFAULT_LOGGING_FLAGS 0x0 #endif // !defined(ELPP_DEFAULT_LOGGING_FLAGS) // Storage +el::base::type::StoragePointer &el::base::Storage::getELPP() +{ + if (!el::base::elStorage) + el::base::elStorage = new el::base::Storage(el::LogBuilderPtr(new el::base::DefaultLogBuilder())); + return el::base::elStorage; +} #if ELPP_ASYNC_LOGGING Storage::Storage(const LogBuilderPtr& defaultLogBuilder, base::IWorker* asyncDispatchWorker) : #else diff --git a/external/easylogging++/easylogging++.h b/external/easylogging++/easylogging++.h index 375010d46..acf2a7674 100644 --- a/external/easylogging++/easylogging++.h +++ b/external/easylogging++/easylogging++.h @@ -552,7 +552,7 @@ typedef std::ostream ostream_t; typedef unsigned int EnumType; typedef unsigned short VerboseLevel; typedef unsigned long int LineNumber; -typedef std::shared_ptr<base::Storage> StoragePointer; +typedef base::Storage *StoragePointer; typedef std::shared_ptr<LogDispatchCallback> LogDispatchCallbackPtr; typedef std::shared_ptr<PerformanceTrackingCallback> PerformanceTrackingCallbackPtr; typedef std::shared_ptr<LoggerRegistrationCallback> LoggerRegistrationCallbackPtr; @@ -2734,6 +2734,8 @@ class Storage : base::NoCopy, public base::threading::ThreadSafe { return it->second; } + static el::base::type::StoragePointer &getELPP(); + private: base::RegisteredHitCounters* m_registeredHitCounters; base::RegisteredLoggers* m_registeredLoggers; @@ -2768,7 +2770,7 @@ class Storage : base::NoCopy, public base::threading::ThreadSafe { } }; extern ELPP_EXPORT base::type::StoragePointer elStorage; -#define ELPP el::base::elStorage +#define ELPP el::base::Storage::getELPP() class DefaultLogDispatchCallback : public LogDispatchCallback { protected: void handle(const LogDispatchData* data); |