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

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: fixes 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
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..5a5c863a7d7e5099d08c2f56d5b99ec0a1a2ea4a 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 = FiletimeToTimevalAmount(user);
+ *system_time = FiletimeToTimevalAmount(kernel);
+ return true;
+}
+
const std::vector<ProcessInfo::Module>& ProcessReaderWin::Modules() {
INITIALIZATION_STATE_DCHECK_VALID(initialized_);

Powered by Google App Engine
This is Rietveld 408576698