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

Side by Side 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 unified diff | Download patch
OLDNEW
(Empty)
1 // Copyright 2017 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #ifndef ATRACE_PROCESS_DUMP_H_
6 #define ATRACE_PROCESS_DUMP_H_
7
8 #include <stdio.h>
9 #include <stdlib.h>
10 #include <unistd.h>
11
12 #include <set>
13 #include <string>
14
15 #include "process_info.h"
16
17 // Utility to collect processes, thread names, per-process memory stats and
18 // other minor metrics from /proc filesystem. It's aimed to extend systrace
19 // with more actionable number to hit performance issues.
20 class AtraceProcessDump {
21 public:
22 // Config is either:
23 // comma-separated list of process names.
24 // "apps" - all Android apps launched from Zygote.
25 // "all" - all non-kernel processes.
26 void SetFullDumpConfig(const std::string& config);
27 void EnableGraphicsStats() { graphics_stats_ = true; }
28 void EnablePrintSmaps() { print_smaps_ = true; }
29 void SetDumpCount(int count) { dump_count_ = count; }
30 void SetDumpInterval(int interval_ms) { dump_interval_ms_ = interval_ms; }
31
32 void RunAndPrintJson(FILE* stream);
33 void Stop() { CloseTimer(); }
Primiano Tucci (use gerrit) 2017/06/26 10:07:20 why this is inlined? coding style says that only s
34
35 private:
36 void SerializeSnapshot(
37 const InstantProcessInfo* snapshot, const std::set<int>& smaps_pids);
38 void SerializeProcessInfo(
39 const PersistentProcessInfo::ProcessMap* processes);
40
41 void SetupTimer();
42 bool WaitForTimer();
43 void CloseTimer();
44
45 int dump_count_;
46 int dump_interval_ms_;
47
48 int timer_fd_;
49 FILE* out_;
50
51 int self_pid_;
52 bool graphics_stats_ = false;
53 bool print_smaps_ = false;
54 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
55 bool full_dump_apps_ = false;
56 std::set<std::string> full_dump_whitelist_;
57 };
58
59 #endif // ATRACE_PROCESS_DUMP_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698