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

Unified Diff: base/process/process_info_linux.cc

Issue 21302005: Add CurrentProcessInfo::CreationTime() for Linux (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix mac Created 7 years, 4 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/process/process_info.h ('k') | base/process/process_info_mac.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/process/process_info_linux.cc
diff --git a/base/process/process_info_linux.cc b/base/process/process_info_linux.cc
new file mode 100644
index 0000000000000000000000000000000000000000..da34c180e8ae4e51f5f0b9ffe53b5f7569307b61
--- /dev/null
+++ b/base/process/process_info_linux.cc
@@ -0,0 +1,27 @@
+// Copyright 2013 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 "base/basictypes.h"
+#include "base/logging.h"
+#include "base/process/internal_linux.h"
+#include "base/process/process_handle.h"
+#include "base/time/time.h"
+
+namespace base {
+
+//static
+const Time CurrentProcessInfo::CreationTime() {
+ ProcessHandle pid = GetCurrentProcessHandle();
+ int start_ticks = internal::ReadProcStatsAndGetFieldAsInt(
+ pid, internal::VM_STARTTIME);
+ DCHECK(start_ticks);
+ TimeDelta start_offset = internal::ClockTicksToTimeDelta(start_ticks);
+ Time boot_time = internal::GetBootTime();
+ DCHECK(!boot_time.is_null());
+ return Time(boot_time + start_offset);
+}
+
+} // namespace base
« no previous file with comments | « base/process/process_info.h ('k') | base/process/process_info_mac.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698