mirror of
https://github.com/monero-project/monero.git
synced 2025-08-23 00:05:09 -04:00
move includes around to lessen overall load
This commit is contained in:
parent
38ecd0526e
commit
09ce03d612
73 changed files with 212 additions and 161 deletions
|
@ -33,6 +33,7 @@
|
|||
#include <boost/archive/binary_iarchive.hpp>
|
||||
#include <boost/archive/portable_binary_oarchive.hpp>
|
||||
#include <boost/archive/portable_binary_iarchive.hpp>
|
||||
#include <boost/filesystem/operations.hpp>
|
||||
|
||||
|
||||
namespace tools
|
||||
|
|
|
@ -34,6 +34,8 @@
|
|||
#include "include_base_utils.h"
|
||||
#include <random>
|
||||
#include <boost/filesystem/fstream.hpp>
|
||||
#include <boost/thread/mutex.hpp>
|
||||
#include <boost/thread/thread.hpp>
|
||||
using namespace epee;
|
||||
namespace bf = boost::filesystem;
|
||||
|
||||
|
|
|
@ -26,6 +26,8 @@
|
|||
// STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF
|
||||
// THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
#include <vector>
|
||||
#include "misc_os_dependent.h"
|
||||
#include "perf_timer.h"
|
||||
|
||||
#undef MONERO_DEFAULT_LOG_CATEGORY
|
||||
|
@ -35,7 +37,8 @@ namespace tools
|
|||
{
|
||||
|
||||
el::Level performance_timer_log_level = el::Level::Debug;
|
||||
__thread std::vector<PerformanceTimer*> *performance_timers = NULL;
|
||||
|
||||
static __thread std::vector<PerformanceTimer*> *performance_timers = NULL;
|
||||
|
||||
void set_performance_timer_log_level(el::Level level)
|
||||
{
|
||||
|
@ -48,4 +51,38 @@ void set_performance_timer_log_level(el::Level level)
|
|||
performance_timer_log_level = level;
|
||||
}
|
||||
|
||||
PerformanceTimer::PerformanceTimer(const std::string &s, uint64_t unit, el::Level l): name(s), unit(unit), level(l), started(false)
|
||||
{
|
||||
ticks = epee::misc_utils::get_ns_count();
|
||||
if (!performance_timers)
|
||||
{
|
||||
MLOG(level, "PERF ----------");
|
||||
performance_timers = new std::vector<PerformanceTimer*>();
|
||||
}
|
||||
else
|
||||
{
|
||||
PerformanceTimer *pt = performance_timers->back();
|
||||
if (!pt->started)
|
||||
{
|
||||
MLOG(pt->level, "PERF " << std::string((performance_timers->size()-1) * 2, ' ') << " " << pt->name);
|
||||
pt->started = true;
|
||||
}
|
||||
}
|
||||
performance_timers->push_back(this);
|
||||
}
|
||||
|
||||
PerformanceTimer::~PerformanceTimer()
|
||||
{
|
||||
performance_timers->pop_back();
|
||||
ticks = epee::misc_utils::get_ns_count() - ticks;
|
||||
char s[12];
|
||||
snprintf(s, sizeof(s), "%8llu ", (unsigned long long)ticks / (1000000000 / unit));
|
||||
MLOG(level, "PERF " << s << std::string(performance_timers->size() * 2, ' ') << " " << name);
|
||||
if (performance_timers->empty())
|
||||
{
|
||||
delete performance_timers;
|
||||
performance_timers = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -41,44 +41,12 @@ namespace tools
|
|||
class PerformanceTimer;
|
||||
|
||||
extern el::Level performance_timer_log_level;
|
||||
extern __thread std::vector<PerformanceTimer*> *performance_timers;
|
||||
|
||||
class PerformanceTimer
|
||||
{
|
||||
public:
|
||||
PerformanceTimer(const std::string &s, uint64_t unit, el::Level l = el::Level::Debug): name(s), unit(unit), level(l), started(false)
|
||||
{
|
||||
ticks = epee::misc_utils::get_ns_count();
|
||||
if (!performance_timers)
|
||||
{
|
||||
MLOG(level, "PERF ----------");
|
||||
performance_timers = new std::vector<PerformanceTimer*>();
|
||||
}
|
||||
else
|
||||
{
|
||||
PerformanceTimer *pt = performance_timers->back();
|
||||
if (!pt->started)
|
||||
{
|
||||
MLOG(pt->level, "PERF " << std::string((performance_timers->size()-1) * 2, ' ') << " " << pt->name);
|
||||
pt->started = true;
|
||||
}
|
||||
}
|
||||
performance_timers->push_back(this);
|
||||
}
|
||||
|
||||
~PerformanceTimer()
|
||||
{
|
||||
performance_timers->pop_back();
|
||||
ticks = epee::misc_utils::get_ns_count() - ticks;
|
||||
char s[12];
|
||||
snprintf(s, sizeof(s), "%8llu ", (unsigned long long)ticks / (1000000000 / unit));
|
||||
MLOG(level, "PERF " << s << std::string(performance_timers->size() * 2, ' ') << " " << name);
|
||||
if (performance_timers->empty())
|
||||
{
|
||||
delete performance_timers;
|
||||
performance_timers = NULL;
|
||||
}
|
||||
}
|
||||
PerformanceTimer(const std::string &s, uint64_t unit, el::Level l = el::Level::Debug);
|
||||
~PerformanceTimer();
|
||||
|
||||
private:
|
||||
std::string name;
|
||||
|
|
|
@ -39,6 +39,7 @@
|
|||
#ifndef STATICLIB
|
||||
#include <dlfcn.h>
|
||||
#endif
|
||||
#include <boost/algorithm/string.hpp>
|
||||
#include "common/stack_trace.h"
|
||||
#include "misc_log_ex.h"
|
||||
|
||||
|
|
|
@ -26,6 +26,7 @@
|
|||
// STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF
|
||||
// THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
#include <boost/algorithm/string.hpp>
|
||||
#include "misc_log_ex.h"
|
||||
#include "util.h"
|
||||
#include "dns_utils.h"
|
||||
|
|
|
@ -54,6 +54,7 @@ using namespace epee;
|
|||
#include <sys/stat.h>
|
||||
#endif
|
||||
#include <boost/filesystem.hpp>
|
||||
#include <boost/algorithm/string.hpp>
|
||||
#include <boost/asio.hpp>
|
||||
#include <openssl/sha.h>
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue