Merge changes I72a3720c,Idac0d0ef am: 0f3f4f402e
Original change: https://android-review.googlesource.com/c/platform/system/core/+/2074258 Change-Id: Iaa2f326f68ef8fbc80af4fd29cde6142ec7a7d16 Ignore-AOSP-First: this is an automerge Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
commit
222a765961
2 changed files with 23 additions and 9 deletions
|
|
@ -140,6 +140,20 @@ static void log_processes(FILE* log) {
|
|||
static void bootchart_thread_main() {
|
||||
LOG(INFO) << "Bootcharting started";
|
||||
|
||||
// Unshare the mount namespace of this thread so that the init process itself can switch
|
||||
// the mount namespace later while this thread is still running.
|
||||
// Otherwise, setns() call invoked as part of `enter_default_mount_ns` fails with EINVAL.
|
||||
//
|
||||
// Note that after unshare()'ing the mount namespace from the main thread, this thread won't
|
||||
// receive mount/unmount events from the other mount namespace unless the events are happening
|
||||
// from under a sharable mount.
|
||||
//
|
||||
// The bootchart thread is safe to unshare the mount namespace because it only reads from /proc
|
||||
// and write to /data which are not private mounts.
|
||||
if (unshare(CLONE_NEWNS) == -1) {
|
||||
PLOG(ERROR) << "Cannot create mount namespace";
|
||||
return;
|
||||
}
|
||||
// Open log files.
|
||||
auto stat_log = fopen_unique("/data/bootchart/proc_stat.log", "we");
|
||||
if (!stat_log) return;
|
||||
|
|
|
|||
|
|
@ -56,24 +56,24 @@ def analyze_process_maps(process_map1, process_map2, jiffy_record):
|
|||
]
|
||||
|
||||
jw = jiffy_record['jiffy_to_wallclock']
|
||||
print "process: baseline experiment (delta)"
|
||||
print " - Unit is ms (a jiffy is %d ms on the system)" % jw
|
||||
print "------------------------------------"
|
||||
print("process: baseline experiment (delta)")
|
||||
print(" - Unit is ms (a jiffy is %d ms on the system)" % jw)
|
||||
print("------------------------------------")
|
||||
for p in processes_of_interest:
|
||||
# e.g., 32-bit system doesn't have zygote64
|
||||
if p in process_map1 and p in process_map2:
|
||||
print "%s: %d %d (%+d)" % (
|
||||
print("%s: %d %d (%+d)" % (
|
||||
p, process_map1[p]['start_time'] * jw,
|
||||
process_map2[p]['start_time'] * jw,
|
||||
(process_map2[p]['start_time'] -
|
||||
process_map1[p]['start_time']) * jw)
|
||||
process_map1[p]['start_time']) * jw))
|
||||
|
||||
# Print the last tick for the bootanimation process
|
||||
print "bootanimation ends at: %d %d (%+d)" % (
|
||||
print("bootanimation ends at: %d %d (%+d)" % (
|
||||
process_map1['/system/bin/bootanimation']['last_tick'] * jw,
|
||||
process_map2['/system/bin/bootanimation']['last_tick'] * jw,
|
||||
(process_map2['/system/bin/bootanimation']['last_tick'] -
|
||||
process_map1['/system/bin/bootanimation']['last_tick']) * jw)
|
||||
process_map1['/system/bin/bootanimation']['last_tick']) * jw))
|
||||
|
||||
def parse_proc_file(pathname, process_map, jiffy_record=None):
|
||||
# Uncompress bootchart.tgz
|
||||
|
|
@ -83,7 +83,7 @@ def parse_proc_file(pathname, process_map, jiffy_record=None):
|
|||
f = tf.extractfile('proc_ps.log')
|
||||
|
||||
# Break proc_ps into chunks based on timestamps
|
||||
blocks = f.read().split('\n\n')
|
||||
blocks = f.read().decode('utf-8').split('\n\n')
|
||||
for b in blocks:
|
||||
lines = b.split('\n')
|
||||
if not lines[0]:
|
||||
|
|
@ -133,7 +133,7 @@ def parse_proc_file(pathname, process_map, jiffy_record=None):
|
|||
|
||||
def main():
|
||||
if len(sys.argv) != 3:
|
||||
print "Usage: %s base_bootchart_dir exp_bootchart_dir" % sys.argv[0]
|
||||
print("Usage: %s base_bootchart_dir exp_bootchart_dir" % sys.argv[0])
|
||||
sys.exit(1)
|
||||
|
||||
process_map1 = {}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue