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

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

Issue 2946033002: Android systrace: Optimize memory dumps. (Closed)
Patch Set: 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
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..9c5fd09957610847beaa67d77b0d6f321e2cd18b
--- /dev/null
+++ b/systrace/atrace_helper/jni/atrace_process_dump.h
@@ -0,0 +1,59 @@
+// 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"
+
+// Utility to collect processes, thread names, per-process memory stats and
+// other minor metrics from /proc filesystem. It's aimed to extend systrace
+// with more actionable number to hit performance issues.
+class AtraceProcessDump {
+ public:
+ // Config is either:
+ // comma-separated list of process names.
+ // "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 SetDumpInterval(int interval_ms) { dump_interval_ms_ = interval_ms; }
+
+ void RunAndPrintJson(FILE* stream);
+ void Stop() { CloseTimer(); }
Primiano Tucci (use gerrit) 2017/06/26 10:07:20 why this is inlined? coding style says that only s
+
+ 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;
Primiano Tucci (use gerrit) 2017/06/26 10:07:20 it feels this should really be an enum: with 3 val
+ 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