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

Unified Diff: base/process/process_info_fuchsia.cc

Issue 2909513003: fuchsia: Implement CurrentProcessInfo
Patch Set: Created 3 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 | « base/BUILD.gn ('k') | base/time/time.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/process/process_info_fuchsia.cc
diff --git a/base/process/process_info_fuchsia.cc b/base/process/process_info_fuchsia.cc
new file mode 100644
index 0000000000000000000000000000000000000000..53f6029ab7a5b333171dbc99c9a75e84d7c90a61
--- /dev/null
+++ b/base/process/process_info_fuchsia.cc
@@ -0,0 +1,30 @@
+// Copyright 2017 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "base/process/process_info.h"
+
+#include <magenta/syscalls.h>
+
+#include "base/time/time.h"
+
+namespace base {
+
+// static
+const Time CurrentProcessInfo::CreationTime() {
+#if 0 // TODO(fuchsia): This requires a newer drop of the Fuchsia SDK.
+ mx_info_thread_stats_t thread_stats;
+ if (mx_object_get_info(mx_thread_self(), MX_INFO_THREAD_STATS, &thread_stats,
+ sizeof(thread_stats), nullptr, nullptr) != NO_ERROR) {
+ return Time();
+ }
+ Time current_time = Time::Now();
+ TimeDelta total_runtime = TimeDelta::FromMicroseconds(
+ thread_stats.total_runtime / base::Time::kNanosecondsPerMicrosecond);
+ return Time(current_time - total_runtime);
+#else
+ return Time();
+#endif
+}
+
+} // namespace base
« no previous file with comments | « base/BUILD.gn ('k') | base/time/time.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698