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

Unified Diff: runtime/vm/isolate.cc

Issue 2583663002: Internally measure isolate uptime with monotonic time. (Closed)
Patch Set: Created 4 years 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/isolate.h ('k') | runtime/vm/json_stream.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/isolate.cc
diff --git a/runtime/vm/isolate.cc b/runtime/vm/isolate.cc
index 7708047f003a3f7acb3a28d864f45718a26aeba5..8304532470999c81ea515843ad6496c8348db0f3 100644
--- a/runtime/vm/isolate.cc
+++ b/runtime/vm/isolate.cc
@@ -779,7 +779,7 @@ Isolate::Isolate(const Dart_IsolateFlags& api_flags)
message_notify_callback_(NULL),
name_(NULL),
debugger_name_(NULL),
- start_time_(OS::GetCurrentTimeMicros()),
+ start_time_micros_(OS::GetCurrentMonotonicMicros()),
main_port_(0),
origin_id_(0),
pause_capability_(0),
@@ -1041,6 +1041,11 @@ void Isolate::set_debugger_name(const char* name) {
}
+int64_t Isolate::UptimeMicros() const {
+ return OS::GetCurrentMonotonicMicros() - start_time_micros_;
+}
+
+
bool Isolate::IsPaused() const {
return (debugger_ != NULL) && (debugger_->PauseEvent() != NULL);
}
@@ -1990,8 +1995,9 @@ void Isolate::PrintJSON(JSONStream* stream, bool ref) {
}
jsobj.AddPropertyF("_originNumber", "%" Pd64 "",
static_cast<int64_t>(origin_id()));
- int64_t start_time_millis = start_time() / kMicrosecondsPerMillisecond;
- jsobj.AddPropertyTimeMillis("startTime", start_time_millis);
+ int64_t uptime_millis = UptimeMicros() / kMicrosecondsPerMillisecond;
+ int64_t start_time = OS::GetCurrentTimeMillis() - uptime_millis;
+ jsobj.AddPropertyTimeMillis("startTime", start_time);
{
JSONObject jsheap(&jsobj, "_heaps");
heap()->PrintToJSONObject(Heap::kNew, &jsheap);
@@ -2240,12 +2246,12 @@ RawObject* Isolate::InvokePendingServiceExtensionCalls() {
if (FLAG_trace_service) {
OS::Print("[+%" Pd64 "ms] Isolate %s invoking _runExtension for %s\n",
- Dart::timestamp(), name(), method_name.ToCString());
+ Dart::UptimeMillis(), name(), method_name.ToCString());
}
result = DartEntry::InvokeFunction(run_extension, arguments);
if (FLAG_trace_service) {
OS::Print("[+%" Pd64 "ms] Isolate %s : _runExtension complete for %s\n",
- Dart::timestamp(), name(), method_name.ToCString());
+ Dart::UptimeMillis(), name(), method_name.ToCString());
}
// Propagate the error.
if (result.IsError()) {
@@ -2284,7 +2290,7 @@ void Isolate::AppendServiceExtensionCall(const Instance& closure,
const Instance& id) {
if (FLAG_trace_service) {
OS::Print("[+%" Pd64 "ms] Isolate %s ENQUEUING request for extension %s\n",
- Dart::timestamp(), name(), method_name.ToCString());
+ Dart::UptimeMillis(), name(), method_name.ToCString());
}
GrowableObjectArray& calls =
GrowableObjectArray::Handle(pending_service_extension_calls());
« no previous file with comments | « runtime/vm/isolate.h ('k') | runtime/vm/json_stream.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698