summaryrefslogtreecommitdiff
path: root/graphics/asymptote/profiler.h
diff options
context:
space:
mode:
Diffstat (limited to 'graphics/asymptote/profiler.h')
-rw-r--r--graphics/asymptote/profiler.h17
1 files changed, 4 insertions, 13 deletions
diff --git a/graphics/asymptote/profiler.h b/graphics/asymptote/profiler.h
index 046d85e403..4c69d8d7f6 100644
--- a/graphics/asymptote/profiler.h
+++ b/graphics/asymptote/profiler.h
@@ -13,6 +13,7 @@
#include <iostream>
#include "inst.h"
+#include "seconds.h"
namespace vm {
@@ -292,27 +293,17 @@ class profiler : public gc {
analyseNode(emptynode);
}
-
// Timing data.
- struct timeval timestamp;
+ utils::cpuTimer timestamp;
void startLap() {
- gettimeofday(&timestamp, 0);
- }
-
- long long timeAndResetLap() {
- struct timeval now;
- gettimeofday(&now, 0);
- long long nsecs = 1000000000LL * (now.tv_sec - timestamp.tv_sec) +
- 1000LL * (now.tv_usec - timestamp.tv_usec);
- timestamp = now;
- return nsecs;
+ timestamp.reset();
}
// Called whenever the stack is about to change, in order to record the time
// duration for the current node.
void recordTime() {
- topnode().nsecs += timeAndResetLap();
+ topnode().nsecs += (long long) timestamp.nanoseconds(true);
}
public: