Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(272)

Unified Diff: runtime/vm/timer.h

Issue 10389023: Fixed compilation time measurement, restructure some code. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « runtime/vm/stub_code_x64_test.cc ('k') | runtime/vm/unit_test.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/timer.h
===================================================================
--- runtime/vm/timer.h (revision 7417)
+++ runtime/vm/timer.h (working copy)
@@ -38,16 +38,24 @@
}
}
- // Get total cummulative elapsed time in micros and reset the counters.
- int64_t TotalElapsedTime() {
+ // Get total cummulative elapsed time in micros.
+ int64_t TotalElapsedTime() const {
if (enabled_) {
int64_t result = total_;
- Reset();
return result;
}
return 0;
}
+ void Reset() {
+ if (enabled_) {
+ start_ = 0;
+ stop_ = 0;
+ total_ = 0;
+ running_ = false;
+ }
+ }
+
// Accessors.
bool enabled() const { return enabled_; }
bool running() const { return running_; }
@@ -63,15 +71,6 @@
return 0;
}
- void Reset() {
- if (enabled_) {
- start_ = 0;
- stop_ = 0;
- total_ = 0;
- running_ = false;
- }
- }
-
int64_t start_;
int64_t stop_;
int64_t total_;
@@ -140,10 +139,10 @@
// code that needs to be timed.
// ....
// }
-class TimerScope : public ValueObject {
+class TimerScope : public StackResource {
public:
- TimerScope(bool flag, Timer* timer)
- : flag_(flag), nested_(false), timer_(timer) {
+ TimerScope(bool flag, Timer* timer, BaseIsolate* isolate = NULL)
+ : StackResource(isolate), flag_(flag), nested_(false), timer_(timer) {
if (flag_) {
if (!timer_->running()) {
timer_->Start();
« no previous file with comments | « runtime/vm/stub_code_x64_test.cc ('k') | runtime/vm/unit_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698