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

Unified Diff: systrace/atrace_helper/jni/process_info.h

Issue 2946033002: Android systrace: Optimize memory dumps. (Closed)
Patch Set: tiny fix Created 3 years, 6 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 | « systrace/atrace_helper/jni/main.cc ('k') | systrace/atrace_helper/jni/process_info.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: systrace/atrace_helper/jni/process_info.h
diff --git a/systrace/atrace_helper/jni/process_info.h b/systrace/atrace_helper/jni/process_info.h
index ff05b334dd9d5efc1a6b584367c1834d1d903e47..089e77e22f94c5957d2fb6a180c6835f13326e53 100644
--- a/systrace/atrace_helper/jni/process_info.h
+++ b/systrace/atrace_helper/jni/process_info.h
@@ -6,66 +6,35 @@
#define PROCESS_INFO_H_
#include <map>
-#include <memory>
#include "process_memory_stats.h"
-// Reads various process stats and details from /proc/pid/.
-class ProcessInfo {
- public:
- struct ThreadInfo {
- char name[128] = {};
- };
- using ThreadInfoMap = std::map<int, std::unique_ptr<ThreadInfo>>;
-
- // Returns true if |pid| is a process (|pid| == TGID), false if it's just a
- // thread of another process, or if |pid| doesn't exist at all.
- static bool IsProcess(int pid);
-
- explicit ProcessInfo(int pid);
-
- bool ReadProcessName();
- bool ReadThreadNames();
- bool ReadOOMStats();
- bool ReadPageFaultsAndCPUTimeStats();
-
- ProcessMemoryStats* memory() { return &memory_; }
- const ProcessMemoryStats* memory() const { return &memory_; }
- const ThreadInfoMap* threads() const { return &threads_; }
- const char* name() const { return name_; }
- const char* exe() const { return exe_; }
-
- int oom_adj() const { return oom_adj_; }
- int oom_score_adj() const { return oom_score_adj_; }
- int oom_score() const { return oom_score_; }
-
- unsigned long minflt() const { return minflt_; }
- unsigned long majflt() const { return majflt_; }
- unsigned long utime() const { return utime_; }
- unsigned long stime() const { return stime_; }
- unsigned long long start_time() const { return start_time_; }
-
- private:
- ProcessInfo(const ProcessInfo&) = delete;
- void operator=(const ProcessInfo&) = delete;
-
- ProcessMemoryStats memory_;
-
- ThreadInfoMap threads_;
- char name_[128] = {};
- char exe_[128] = {};
-
- int oom_adj_ = 0;
- int oom_score_adj_ = 0;
- int oom_score_ = 0;
+struct ThreadInfo {
+ int tid;
+ char name[16];
+};
- unsigned long minflt_ = 0;
- unsigned long majflt_ = 0;
- unsigned long utime_ = 0; // CPU time in user mode.
- unsigned long stime_ = 0; // CPU time in kernel mode.
- unsigned long long start_time_ = 0; // CPU time in kernel mode.
+struct ProcessInfo {
+ int pid;
+ bool in_kernel;
+ bool is_app;
+ char name[256];
+ char exe[256];
+ std::map<int, ThreadInfo> threads;
+};
- const int pid_;
+struct ProcessSnapshot {
+ int pid;
+ ProcessMemoryStats memory;
+ // OOM badness and tolerance (oom_adj is deprecated).
+ int oom_score;
+ int oom_score_adj;
+ // Page faults.
+ unsigned long minor_faults;
+ unsigned long major_faults;
+ // Time spent in userspace and in the kernel.
+ unsigned long utime;
+ unsigned long stime;
};
#endif // PROCESS_INFO_H_
« no previous file with comments | « systrace/atrace_helper/jni/main.cc ('k') | systrace/atrace_helper/jni/process_info.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698