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

Unified Diff: snapshot/win/process_reader_win.cc

Issue 1119393003: win: Add support for CPUTimes and StartTime to snapshot (Closed) Base URL: https://chromium.googlesource.com/crashpad/crashpad@generate-dump
Patch Set: fix whitespace error Created 5 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « snapshot/win/process_reader_win.h ('k') | snapshot/win/process_snapshot_win.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..84e176b8739dcdee035210dcdeb6850d44d12db6 100644
--- a/snapshot/win/process_reader_win.cc
+++ b/snapshot/win/process_reader_win.cc
@@ -15,6 +15,7 @@
#include "snapshot/win/process_reader_win.h"
#include "base/numerics/safe_conversions.h"
+#include "util/win/time.h"
namespace crashpad {
@@ -54,6 +55,28 @@ 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";
+ 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";
+ return false;
+ }
+ *user_time = FiletimeToTimevalInterval(user);
+ *system_time = FiletimeToTimevalInterval(kernel);
+ return true;
+}
+
const std::vector<ProcessInfo::Module>& ProcessReaderWin::Modules() {
INITIALIZATION_STATE_DCHECK_VALID(initialized_);
« no previous file with comments | « snapshot/win/process_reader_win.h ('k') | snapshot/win/process_snapshot_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698