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..b216b42928bfc76b9f75a20a4be24e6ab7973a4e |
--- /dev/null |
+++ b/base/process/process_info_linux.cc |
@@ -0,0 +1,37 @@ |
+// 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 { |
+namespace { |
+ |
+using base::Time; |
+ |
+Time* ProcessCreationTimeInternal() { |
+ 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 new Time(boot_time + start_offset); |
+} |
+ |
+} // namespace |
+ |
+//static |
+const Time* CurrentProcessInfo::CreationTime() { |
+ static Time* process_creation_time = ProcessCreationTimeInternal(); |
jln (very slow on Chromium)
2013/08/06 18:57:29
This caching seems a bit dangerous on Linux.
We u
James Simonsen
2013/08/06 19:09:08
I'll just remove it. It's done this way because th
|
+ return process_creation_time; |
+} |
+ |
+} // namespace base |