Chromium Code Reviews| Index: snapshot/win/process_reader_win.cc |
| diff --git a/snapshot/win/process_reader_win.cc b/snapshot/win/process_reader_win.cc |
| index c0a3c56b454207a1b4669a3e2de9ae0ddba8a429..f08822eb7607f0f61bf095152a3b0c42f876b723 100644 |
| --- a/snapshot/win/process_reader_win.cc |
| +++ b/snapshot/win/process_reader_win.cc |
| @@ -15,9 +15,19 @@ |
| #include "snapshot/win/process_reader_win.h" |
| #include "base/numerics/safe_conversions.h" |
| +#include "util/win/time.h" |
| namespace crashpad { |
| +namespace { |
| + |
| +void TimerClear(timeval* tv) { |
|
Mark Mentovai
2015/05/04 21:29:23
Do this in compat if it’s needed elsewhere, or jus
scottmg
2015/05/05 16:45:48
Done.
|
| + tv->tv_sec = 0; |
| + tv->tv_usec = 0; |
| +} |
| + |
| +} // namespace |
| + |
| ProcessReaderWin::ProcessReaderWin() |
| : process_(INVALID_HANDLE_VALUE), |
| process_info_(), |
| @@ -54,6 +64,31 @@ bool ProcessReaderWin::ReadMemory(WinVMAddress at, |
| return true; |
| } |
| +bool ProcessReaderWin::StartTime(timeval* start_time) const { |
| + FILETIME creation, exit, kernel, user; |
| + if (!GetProcessTimes(process_, &creation, &exit, &kernel, &user)) { |
| + PLOG(ERROR) << "GetProcessTimes"; |
| + TimerClear(start_time); |
| + return false; |
| + } |
| + *start_time = FiletimeToTimevalEpoch(creation); |
| + return true; |
| +} |
| + |
| +bool ProcessReaderWin::CPUTimes(timeval* user_time, |
| + timeval* system_time) const { |
| + FILETIME creation, exit, kernel, user; |
| + if (!GetProcessTimes(process_, &creation, &exit, &kernel, &user)) { |
| + PLOG(ERROR) << "GetProcessTimes"; |
| + TimerClear(user_time); |
| + TimerClear(system_time); |
| + return false; |
| + } |
| + *user_time = FiletimeToTimevalAmount(user); |
| + *system_time = FiletimeToTimevalAmount(kernel); |
| + return true; |
| +} |
| + |
| const std::vector<ProcessInfo::Module>& ProcessReaderWin::Modules() { |
| INITIALIZATION_STATE_DCHECK_VALID(initialized_); |