gyp fixes

This commit is contained in:
Konstantin Käfer
2014-10-28 12:47:58 -04:00
parent 602b9da992
commit dbddd3c904
15 changed files with 170 additions and 149 deletions

View File

@@ -1,5 +1,5 @@
#ifndef DISABLE_TIMER
#include <mbgl/util/timer.hpp>
#ifndef DISABLE_STOPWATCH
#include <mbgl/util/stopwatch.hpp>
#include <mbgl/util/time.hpp>
#include <mbgl/platform/log.hpp>
@@ -8,26 +8,26 @@
using namespace mbgl::util;
timer::timer(Event event_)
stopwatch::stopwatch(Event event_)
: event(event_), start(now()) {}
timer::timer(EventSeverity severity_, Event event_)
stopwatch::stopwatch(EventSeverity severity_, Event event_)
: severity(severity_), event(event_), start(now()) {}
timer::timer(const std::string &name_, Event event_)
stopwatch::stopwatch(const std::string &name_, Event event_)
: name(name_), event(event_), start(now()) {}
timer::timer(const std::string &name_, EventSeverity severity_, Event event_)
stopwatch::stopwatch(const std::string &name_, EventSeverity severity_, Event event_)
: name(name_), severity(severity_), event(event_), start(now()) {}
void timer::report(const std::string &name_) {
void stopwatch::report(const std::string &name_) {
timestamp duration = now() - start;
Log::Record(severity, event, name_ + ": " + std::to_string((double)(duration) / 1_millisecond) + "ms");
start += duration;
}
timer::~timer() {
stopwatch::~stopwatch() {
if (name.size()) {
report(name);
}