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

Side by Side 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 unified diff | Download patch
« no previous file with comments | « base/BUILD.gn ('k') | base/time/time.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright 2017 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "base/process/process_info.h"
6
7 #include <magenta/syscalls.h>
8
9 #include "base/time/time.h"
10
11 namespace base {
12
13 // static
14 const Time CurrentProcessInfo::CreationTime() {
15 #if 0 // TODO(fuchsia): This requires a newer drop of the Fuchsia SDK.
16 mx_info_thread_stats_t thread_stats;
17 if (mx_object_get_info(mx_thread_self(), MX_INFO_THREAD_STATS, &thread_stats,
18 sizeof(thread_stats), nullptr, nullptr) != NO_ERROR) {
19 return Time();
20 }
21 Time current_time = Time::Now();
22 TimeDelta total_runtime = TimeDelta::FromMicroseconds(
23 thread_stats.total_runtime / base::Time::kNanosecondsPerMicrosecond);
24 return Time(current_time - total_runtime);
25 #else
26 return Time();
27 #endif
28 }
29
30 } // namespace base
OLDNEW
« 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