{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "YouTube per-CPU TGID residency analysis\n", "=======================\n", "This is a run of experiments/run_youtube.py with the cgroups module enabled.\n", "This notebook parses and plots the trace.html" ] }, { "cell_type": "code", "execution_count": 6, "metadata": { "collapsed": false }, "outputs": [ { "name": "stderr", "output_type": "stream", "text": [ "2017-07-15 01:23:58,298 INFO : root : Using LISA logging configuration:\n", "2017-07-15 01:23:58,301 INFO : root : /home/joelaf/repo/lisa-aosp/external/lisa/logging.conf\n", "2017-07-15 01:23:58,303 INFO : root : #### Setup FTrace\n" ] } ], "source": [ "#!/usr/bin/env python\n", "%pylab inline\n", "import trappy\n", "from trace import Trace\n", "import itertools\n", "import logging\n", "import pandas as pd\n", "import numpy as np\n", "import os\n", "\n", "from conf import LisaLogging\n", "LisaLogging.setup()\n", "logging.info('#### Setup FTrace')\n", "# path_to_html = \"/home/joelaf/repo/lisa-aosp/external/lisa/results/UiBench_default/trace.html\"\n", "# path_to_html = \"/home/joelaf/repo/lisa-aosp/external/lisa/ipynb/residency/trace-residency.html\"\n", "path_to_html = \"/home/joelaf/repo/lisa-aosp/external/lisa/results/YouTube_cgroups/trace.html\"" ] }, { "cell_type": "code", "execution_count": 24, "metadata": { "collapsed": false }, "outputs": [], "source": [ "def plot_cgroups(df):\n", " # Bug in matplot lib causes plotting issues when residency is < 1\n", " df = df.apply(lambda x: x*10)\n", " plt.style.use('ggplot')\n", " colors = plt.rcParams['axes.color_cycle']\n", " fig, axes = plt.subplots(nrows=5, ncols=2, figsize=(12,30))\n", "\n", " for ax, col in zip(axes.flat, df.columns):\n", " ax.pie(df[col], labels=df.index, autopct='%.2f', colors=colors)\n", " ax.set(ylabel='', title=col, aspect='equal')\n", "\n", " axes[0, 0].legend(bbox_to_anchor=(0, 0.5))\n", "\n", " # fig.savefig('your_file.png') # Or whichever format you'd like\n", " plt.show()\n", "\n", "tr = Trace(None, path_to_html,\n", " cgroup_info = { \n", " 'cgroups': ['foreground', 'background', 'system-background', 'top-app', 'rt'],\n", " 'controller_ids': { 4: 'cpuset', 2: 'schedtune' }\n", " },\n", " events=[ 'sched_switch', 'cgroup_attach_task_devlib', 'cgroup_attach_task', 'sched_process_fork' ],\n", " normalize_time=False)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Total amount of time spent per TGID\n", "===========================" ] }, { "cell_type": "code", "execution_count": 25, "metadata": { "collapsed": false, "scrolled": true }, "outputs": [ { "name": "stderr", "output_type": "stream", "text": [ "2017-07-15 01:44:22,594 INFO : root : TOTAL number of CPUs: 8\n", "2017-07-15 01:44:22,595 INFO : root : TOTAL number of PIDs: 951\n", "2017-07-15 01:44:22,596 INFO : root : TOTAL number of TGIDs: 950\n", "2017-07-15 01:44:37,907 INFO : root : Generating residency for 185 tgid_comms!\n", "2017-07-15 01:44:37,912 INFO : root : total time spent by all pids across all cpus: 259.21056\n", "2017-07-15 01:44:37,913 INFO : root : total real time range of events: 32.083223\n" ] }, { "data": { "text/html": [ "
\n", " | cpu_0 | \n", "cpu_1 | \n", "cpu_2 | \n", "cpu_3 | \n", "cpu_4 | \n", "cpu_5 | \n", "cpu_6 | \n", "cpu_7 | \n", "total | \n", "
---|---|---|---|---|---|---|---|---|---|
tgid_comm | \n", "\n", " | \n", " | \n", " | \n", " | \n", " | \n", " | \n", " | \n", " | \n", " |
.gms.persistent | \n", "0.126132 | \n", "0.093887 | \n", "0.129987 | \n", "0.114014 | \n", "0.000000 | \n", "0.000000 | \n", "0.282906 | \n", "0.346375 | \n", "1.093301 | \n", "
android.youtube | \n", "0.378246 | \n", "0.195657 | \n", "0.111728 | \n", "0.085123 | \n", "3.883613 | \n", "2.620660 | \n", "1.138236 | \n", "0.341751 | \n", "8.755014 | \n", "
audioserver | \n", "0.324777 | \n", "0.539268 | \n", "0.179528 | \n", "0.138533 | \n", "0.000000 | \n", "0.000000 | \n", "0.034319 | \n", "0.012857 | \n", "1.229282 | \n", "
composer@2.1-se | \n", "0.637039 | \n", "1.714824 | \n", "0.122500 | \n", "0.064408 | \n", "0.000860 | \n", "0.000000 | \n", "0.002368 | \n", "0.003812 | \n", "2.545811 | \n", "
mdss_fb0 | \n", "0.000000 | \n", "0.000000 | \n", "0.488047 | \n", "0.917949 | \n", "0.000000 | \n", "0.000000 | \n", "0.000000 | \n", "0.000000 | \n", "1.405996 | \n", "
sh | \n", "0.123595 | \n", "0.017595 | \n", "0.023969 | \n", "0.117765 | \n", "0.184260 | \n", "0.135337 | \n", "0.054405 | \n", "0.174685 | \n", "0.831611 | \n", "
surfaceflinger | \n", "2.122230 | \n", "1.033651 | \n", "0.383079 | \n", "0.127894 | \n", "0.379442 | \n", "0.077457 | \n", "0.030958 | \n", "0.010078 | \n", "4.164789 | \n", "
system_server | \n", "0.445757 | \n", "0.499595 | \n", "0.493926 | \n", "0.267354 | \n", "0.010206 | \n", "0.001380 | \n", "0.409837 | \n", "1.059832 | \n", "3.187887 | \n", "
NaN | \n", "24.169153 | \n", "26.310930 | \n", "28.413301 | \n", "29.423310 | \n", "27.095635 | \n", "28.958375 | \n", "29.406846 | \n", "29.596954 | \n", "223.374504 | \n", "