Optimize implementation of "replace substrings after offset" utility function to
[chromium-blink-merge.git] / base / process / process_info_linux.cc
blob9ec23135bfce0ec681bf7746cb363b95bdc20933
1 // Copyright 2013 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.
5 #include "base/process/process_info.h"
7 #include "base/basictypes.h"
8 #include "base/logging.h"
9 #include "base/process/internal_linux.h"
10 #include "base/process/process_handle.h"
11 #include "base/time/time.h"
13 namespace base {
15 //static
16 const Time CurrentProcessInfo::CreationTime() {
17 ProcessHandle pid = GetCurrentProcessHandle();
18 int64 start_ticks =
19 internal::ReadProcStatsAndGetFieldAsInt64(pid, internal::VM_STARTTIME);
20 DCHECK(start_ticks);
21 TimeDelta start_offset = internal::ClockTicksToTimeDelta(start_ticks);
22 Time boot_time = internal::GetBootTime();
23 DCHECK(!boot_time.is_null());
24 return Time(boot_time + start_offset);
27 } // namespace base