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

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

Issue 2946033002: Android systrace: Optimize memory dumps. (Closed)
Patch Set: for review 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
Index: systrace/atrace_helper/jni/atrace_process_dump.h
diff --git a/systrace/atrace_helper/jni/atrace_process_dump.h b/systrace/atrace_helper/jni/atrace_process_dump.h
new file mode 100644
index 0000000000000000000000000000000000000000..4aaac76ee17a7933af1d7ce7ffcdfb8716d80b52
--- /dev/null
+++ b/systrace/atrace_helper/jni/atrace_process_dump.h
@@ -0,0 +1,56 @@
+// Copyright 2017 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef ATRACE_PROCESS_DUMP_H_
+#define ATRACE_PROCESS_DUMP_H_
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
+
+#include <set>
+#include <string>
+
+#include "process_info.h"
+
+class AtraceProcessDump {
Primiano Tucci (use gerrit) 2017/06/22 07:55:51 some lines of comment explaining what this class d
kraynov 2017/06/22 09:19:44 Done.
+ public:
+ // Config is either:
+ // comma-separated list - only processes with named in the list.
Primiano Tucci (use gerrit) 2017/06/22 07:55:51 i'd just say here: comma-separate list of process
kraynov 2017/06/22 09:19:44 Done.
+ // "apps" - all Android apps launched from Zygote.
+ // "all" - all non-kernel processes.
+ void SetFullDumpConfig(const std::string& config);
+ void EnableGraphicsStats() { graphics_stats_ = true; }
+ void EnablePrintSmaps() { print_smaps_ = true; }
+ void SetDumpCount(int count) { dump_count_ = count; }
+ void SetDumpFrequency(int interval_ms) { dump_interval_ms_ = interval_ms; }
Primiano Tucci (use gerrit) 2017/06/22 07:55:51 You call the setter Frequency but the argument is
kraynov 2017/06/22 09:19:44 Done.
+
+ void RunAndPrintJson(FILE* stream);
+ void Stop() { CloseTimer(); }
+
+ private:
+ void SerializeSnapshot(
+ const InstantProcessInfo* snapshot, const std::set<int>& smaps_pids);
+ void SerializeProcessInfo(
+ const PersistentProcessInfo::ProcessMap* processes);
+
+ void SetupTimer();
+ bool WaitForTimer();
+ void CloseTimer();
+
+ int dump_count_;
+ int dump_interval_ms_;
+
+ int timer_fd_;
+ FILE* out_;
+
+ int self_pid_;
+ bool graphics_stats_ = false;
+ bool print_smaps_ = false;
+ bool full_dump_all_ = false;
+ bool full_dump_apps_ = false;
+ std::set<std::string> full_dump_whitelist_;
+};
+
+#endif // ATRACE_PROCESS_DUMP_H_

Powered by Google App Engine
This is Rietveld 408576698