18c2ecf20Sopenharmony_ci                                                _
28c2ecf20Sopenharmony_ci    _ __  _ __ ___         __ _ _ __ __ _ _ __ | |__
38c2ecf20Sopenharmony_ci   | '_ \| '_ ` _ \ _____ / _` | '__/ _` | '_ \| '_ \
48c2ecf20Sopenharmony_ci   | |_) | | | | | |_____| (_| | | | (_| | |_) | | | |
58c2ecf20Sopenharmony_ci   | .__/|_| |_| |_|      \__, |_|  \__,_| .__/|_| |_|
68c2ecf20Sopenharmony_ci   |_|                    |___/          |_|
78c2ecf20Sopenharmony_ci
88c2ecf20Sopenharmony_ci   pm-graph: suspend/resume/boot timing analysis tools
98c2ecf20Sopenharmony_ci    Version: 5.7
108c2ecf20Sopenharmony_ci     Author: Todd Brandt <todd.e.brandt@intel.com>
118c2ecf20Sopenharmony_ci  Home Page: https://01.org/pm-graph
128c2ecf20Sopenharmony_ci
138c2ecf20Sopenharmony_ci Report bugs/issues at bugzilla.kernel.org Tools/pm-graph
148c2ecf20Sopenharmony_ci	- https://bugzilla.kernel.org/buglist.cgi?component=pm-graph&product=Tools
158c2ecf20Sopenharmony_ci
168c2ecf20Sopenharmony_ci Full documentation available online & in man pages
178c2ecf20Sopenharmony_ci	- Getting Started:
188c2ecf20Sopenharmony_ci	  https://01.org/pm-graph/documentation/getting-started
198c2ecf20Sopenharmony_ci
208c2ecf20Sopenharmony_ci	- Config File Format:
218c2ecf20Sopenharmony_ci	  https://01.org/pm-graph/documentation/3-config-file-format
228c2ecf20Sopenharmony_ci
238c2ecf20Sopenharmony_ci	- upstream version in git:
248c2ecf20Sopenharmony_ci	  https://github.com/intel/pm-graph/
258c2ecf20Sopenharmony_ci
268c2ecf20Sopenharmony_ci Table of Contents
278c2ecf20Sopenharmony_ci	- Overview
288c2ecf20Sopenharmony_ci	- Setup
298c2ecf20Sopenharmony_ci	- Usage
308c2ecf20Sopenharmony_ci		- Basic Usage
318c2ecf20Sopenharmony_ci		- Dev Mode Usage
328c2ecf20Sopenharmony_ci		- Proc Mode Usage
338c2ecf20Sopenharmony_ci	- Endurance Testing
348c2ecf20Sopenharmony_ci		- Usage Examples
358c2ecf20Sopenharmony_ci	- Configuration Files
368c2ecf20Sopenharmony_ci		- Usage Examples
378c2ecf20Sopenharmony_ci		- Config File Options
388c2ecf20Sopenharmony_ci	- Custom Timeline Entries
398c2ecf20Sopenharmony_ci		- Adding/Editing Timeline Functions
408c2ecf20Sopenharmony_ci		- Adding/Editing Dev Timeline Source Functions
418c2ecf20Sopenharmony_ci		- Verifying your Custom Functions
428c2ecf20Sopenharmony_ci	- Testing on consumer linux Operating Systems
438c2ecf20Sopenharmony_ci		- Android
448c2ecf20Sopenharmony_ci
458c2ecf20Sopenharmony_ci------------------------------------------------------------------
468c2ecf20Sopenharmony_ci|                          OVERVIEW                              |
478c2ecf20Sopenharmony_ci------------------------------------------------------------------
488c2ecf20Sopenharmony_ci
498c2ecf20Sopenharmony_ci This tool suite is designed to assist kernel and OS developers in optimizing
508c2ecf20Sopenharmony_ci their linux stack's suspend/resume & boot time. Using a kernel image built
518c2ecf20Sopenharmony_ci with a few extra options enabled, the tools will execute a suspend or boot,
528c2ecf20Sopenharmony_ci and will capture dmesg and ftrace data. This data is transformed into a set of
538c2ecf20Sopenharmony_ci timelines and a callgraph to give a quick and detailed view of which devices
548c2ecf20Sopenharmony_ci and kernel processes are taking the most time in suspend/resume & boot.
558c2ecf20Sopenharmony_ci
568c2ecf20Sopenharmony_ci------------------------------------------------------------------
578c2ecf20Sopenharmony_ci|                            SETUP                               |
588c2ecf20Sopenharmony_ci------------------------------------------------------------------
598c2ecf20Sopenharmony_ci
608c2ecf20Sopenharmony_ci    Package Requirements
618c2ecf20Sopenharmony_ci       - runs with python2 or python3, choice is made by /usr/bin/python link
628c2ecf20Sopenharmony_ci       - python
638c2ecf20Sopenharmony_ci       - python-configparser (for python2 sleepgraph)
648c2ecf20Sopenharmony_ci       - python-requests (for googlesheet.py)
658c2ecf20Sopenharmony_ci       - linux-tools-common (for turbostat usage in sleepgraph)
668c2ecf20Sopenharmony_ci
678c2ecf20Sopenharmony_ci       Ubuntu:
688c2ecf20Sopenharmony_ci          sudo apt-get install python python-configparser python-requests linux-tools-common
698c2ecf20Sopenharmony_ci
708c2ecf20Sopenharmony_ci       Fedora:
718c2ecf20Sopenharmony_ci          sudo dnf install python python-configparser python-requests linux-tools-common
728c2ecf20Sopenharmony_ci
738c2ecf20Sopenharmony_ci    The tools can most easily be installed via git clone and make install
748c2ecf20Sopenharmony_ci
758c2ecf20Sopenharmony_ci    $> git clone http://github.com/intel/pm-graph.git
768c2ecf20Sopenharmony_ci    $> cd pm-graph
778c2ecf20Sopenharmony_ci    $> sudo make install
788c2ecf20Sopenharmony_ci    $> man sleepgraph ; man bootgraph
798c2ecf20Sopenharmony_ci
808c2ecf20Sopenharmony_ci    Setup involves some minor kernel configuration
818c2ecf20Sopenharmony_ci
828c2ecf20Sopenharmony_ci    The following kernel build options are required for all kernels:
838c2ecf20Sopenharmony_ci        CONFIG_DEVMEM=y
848c2ecf20Sopenharmony_ci        CONFIG_PM_DEBUG=y
858c2ecf20Sopenharmony_ci        CONFIG_PM_SLEEP_DEBUG=y
868c2ecf20Sopenharmony_ci        CONFIG_FTRACE=y
878c2ecf20Sopenharmony_ci        CONFIG_FUNCTION_TRACER=y
888c2ecf20Sopenharmony_ci        CONFIG_FUNCTION_GRAPH_TRACER=y
898c2ecf20Sopenharmony_ci        CONFIG_KPROBES=y
908c2ecf20Sopenharmony_ci        CONFIG_KPROBES_ON_FTRACE=y
918c2ecf20Sopenharmony_ci
928c2ecf20Sopenharmony_ci	In kernel 3.15.0, two patches were upstreamed which enable the
938c2ecf20Sopenharmony_ci        v3.0 behavior. These patches allow the tool to read all the
948c2ecf20Sopenharmony_ci        data from trace events instead of from dmesg. You can enable
958c2ecf20Sopenharmony_ci        this behavior on earlier kernels with these patches:
968c2ecf20Sopenharmony_ci
978c2ecf20Sopenharmony_ci        (kernel/pre-3.15/enable_trace_events_suspend_resume.patch)
988c2ecf20Sopenharmony_ci        (kernel/pre-3.15/enable_trace_events_device_pm_callback.patch)
998c2ecf20Sopenharmony_ci
1008c2ecf20Sopenharmony_ci	If you're using a kernel older than 3.15.0, the following
1018c2ecf20Sopenharmony_ci        additional kernel parameters are required:
1028c2ecf20Sopenharmony_ci        (e.g. in file /etc/default/grub)
1038c2ecf20Sopenharmony_ci        GRUB_CMDLINE_LINUX_DEFAULT="... initcall_debug log_buf_len=32M ..."
1048c2ecf20Sopenharmony_ci
1058c2ecf20Sopenharmony_ci	If you're using a kernel older than 3.11-rc2, the following simple
1068c2ecf20Sopenharmony_ci		patch must be applied to enable ftrace data:
1078c2ecf20Sopenharmony_ci        in file: kernel/power/suspend.c
1088c2ecf20Sopenharmony_ci        in function: int suspend_devices_and_enter(suspend_state_t state)
1098c2ecf20Sopenharmony_ci        remove call to "ftrace_stop();"
1108c2ecf20Sopenharmony_ci        remove call to "ftrace_start();"
1118c2ecf20Sopenharmony_ci
1128c2ecf20Sopenharmony_ci        There is a patch which does this for kernel v3.8.0:
1138c2ecf20Sopenharmony_ci        (kernel/pre-3.11-rc2/enable_ftrace_in_suspendresume.patch)
1148c2ecf20Sopenharmony_ci
1158c2ecf20Sopenharmony_ci
1168c2ecf20Sopenharmony_ci
1178c2ecf20Sopenharmony_ci------------------------------------------------------------------
1188c2ecf20Sopenharmony_ci|                            USAGE                               |
1198c2ecf20Sopenharmony_ci------------------------------------------------------------------
1208c2ecf20Sopenharmony_ci
1218c2ecf20Sopenharmony_ciBasic Usage
1228c2ecf20Sopenharmony_ci___________
1238c2ecf20Sopenharmony_ci
1248c2ecf20Sopenharmony_ci 1) First configure a kernel using the instructions from the previous sections.
1258c2ecf20Sopenharmony_ci    Then build, install, and boot with it.
1268c2ecf20Sopenharmony_ci 2) Open up a terminal window and execute the mode list command:
1278c2ecf20Sopenharmony_ci
1288c2ecf20Sopenharmony_ci	%> sudo ./sleepgraph.py -modes
1298c2ecf20Sopenharmony_ci		['freeze', 'mem', 'disk']
1308c2ecf20Sopenharmony_ci
1318c2ecf20Sopenharmony_ci Execute a test using one of the available power modes, e.g. mem (S3):
1328c2ecf20Sopenharmony_ci
1338c2ecf20Sopenharmony_ci	%> sudo ./sleepgraph.py -m mem -rtcwake 15
1348c2ecf20Sopenharmony_ci
1358c2ecf20Sopenharmony_ci		or with a config file
1368c2ecf20Sopenharmony_ci
1378c2ecf20Sopenharmony_ci	%> sudo ./sleepgraph.py -config config/suspend.cfg
1388c2ecf20Sopenharmony_ci
1398c2ecf20Sopenharmony_ci When the system comes back you'll see the script finishing up and
1408c2ecf20Sopenharmony_ci creating the output files in the test subdir. It generates output
1418c2ecf20Sopenharmony_ci files in subdirectory: suspend-mmddyy-HHMMSS. The ftrace file can
1428c2ecf20Sopenharmony_ci be used to regenerate the html timeline with different options
1438c2ecf20Sopenharmony_ci
1448c2ecf20Sopenharmony_ci     HTML output:                    <hostname>_<mode>.html
1458c2ecf20Sopenharmony_ci     raw dmesg output:               <hostname>_<mode>_dmesg.txt
1468c2ecf20Sopenharmony_ci     raw ftrace output:              <hostname>_<mode>_ftrace.txt
1478c2ecf20Sopenharmony_ci
1488c2ecf20Sopenharmony_ci View the html in firefox or chrome.
1498c2ecf20Sopenharmony_ci
1508c2ecf20Sopenharmony_ci
1518c2ecf20Sopenharmony_ciDev Mode Usage
1528c2ecf20Sopenharmony_ci______________
1538c2ecf20Sopenharmony_ci
1548c2ecf20Sopenharmony_ci Developer mode adds information on low level source calls to the timeline.
1558c2ecf20Sopenharmony_ci The tool sets kprobes on all delay and mutex calls to see which devices
1568c2ecf20Sopenharmony_ci are waiting for something and when. It also sets a suite of kprobes on
1578c2ecf20Sopenharmony_ci subsystem dependent calls to better fill out the timeline.
1588c2ecf20Sopenharmony_ci
1598c2ecf20Sopenharmony_ci The tool will also expose kernel threads that don't normally show up in the
1608c2ecf20Sopenharmony_ci timeline. This is useful in discovering dependent threads to get a better
1618c2ecf20Sopenharmony_ci idea of what each device is waiting for. For instance, the scsi_eh thread,
1628c2ecf20Sopenharmony_ci a.k.a. scsi resume error handler, is what each SATA disk device waits for
1638c2ecf20Sopenharmony_ci before it can continue resume.
1648c2ecf20Sopenharmony_ci
1658c2ecf20Sopenharmony_ci The timeline will be much larger if run with dev mode, so it can be useful
1668c2ecf20Sopenharmony_ci to set the -mindev option to clip out any device blocks that are too small
1678c2ecf20Sopenharmony_ci to see easily. The following command will give a nice dev mode run:
1688c2ecf20Sopenharmony_ci
1698c2ecf20Sopenharmony_ci %> sudo ./sleepgraph.py -m mem -rtcwake 15 -mindev 1 -dev
1708c2ecf20Sopenharmony_ci
1718c2ecf20Sopenharmony_ci	or with a config file
1728c2ecf20Sopenharmony_ci
1738c2ecf20Sopenharmony_ci %> sudo ./sleepgraph.py -config config/suspend-dev.cfg
1748c2ecf20Sopenharmony_ci
1758c2ecf20Sopenharmony_ci
1768c2ecf20Sopenharmony_ciProc Mode Usage
1778c2ecf20Sopenharmony_ci_______________
1788c2ecf20Sopenharmony_ci
1798c2ecf20Sopenharmony_ci Proc mode adds user process info to the timeline. This is done in a manner
1808c2ecf20Sopenharmony_ci similar to the bootchart utility, which graphs init processes and their
1818c2ecf20Sopenharmony_ci execution as the system boots. This tool option does the same thing but for
1828c2ecf20Sopenharmony_ci the period before and after suspend/resume.
1838c2ecf20Sopenharmony_ci
1848c2ecf20Sopenharmony_ci In order to see any process info, there needs to be some delay before or
1858c2ecf20Sopenharmony_ci after resume since processes are frozen in suspend_prepare and thawed in
1868c2ecf20Sopenharmony_ci resume_complete. The predelay and postdelay args allow you to do this. It
1878c2ecf20Sopenharmony_ci can also be useful to run in x2 mode with an x2 delay, this way you can
1888c2ecf20Sopenharmony_ci see process activity before and after resume, and in between two
1898c2ecf20Sopenharmony_ci successive suspend/resumes.
1908c2ecf20Sopenharmony_ci
1918c2ecf20Sopenharmony_ci The command can be run like this:
1928c2ecf20Sopenharmony_ci
1938c2ecf20Sopenharmony_ci %> sudo ./sleepgraph.py -m mem -rtcwake 15 -x2 -x2delay 1000 -predelay 1000 -postdelay 1000 -proc
1948c2ecf20Sopenharmony_ci
1958c2ecf20Sopenharmony_ci	or with a config file
1968c2ecf20Sopenharmony_ci
1978c2ecf20Sopenharmony_ci %> sudo ./sleepgraph.py -config config/suspend-proc.cfg
1988c2ecf20Sopenharmony_ci
1998c2ecf20Sopenharmony_ci------------------------------------------------------------------
2008c2ecf20Sopenharmony_ci|                     ENDURANCE TESTING                          |
2018c2ecf20Sopenharmony_ci------------------------------------------------------------------
2028c2ecf20Sopenharmony_ci
2038c2ecf20Sopenharmony_ci The best way to gauge the health of a system is to run a series of
2048c2ecf20Sopenharmony_ci suspend/resumes over an extended period and analyze the behavior. This can be
2058c2ecf20Sopenharmony_ci accomplished with sleepgraph's -multi argument. You specify two numbers: the
2068c2ecf20Sopenharmony_ci number of tests to run OR the duration in days, hours, or minutes, and the
2078c2ecf20Sopenharmony_ci delay in seconds between them. For instance, -multi 20 5: execute 20 tests with
2088c2ecf20Sopenharmony_ci a 5 second delay between each, or -multi 24h 0: execute tests over a 24 hour
2098c2ecf20Sopenharmony_ci period with no delay between tests. You can include any other options you like
2108c2ecf20Sopenharmony_ci to generate the data you want. It's most useful to collect dev mode timelines
2118c2ecf20Sopenharmony_ci as the kprobes don't alter the performance much and you get more insight.
2128c2ecf20Sopenharmony_ci
2138c2ecf20Sopenharmony_ci On completion, the output folder contains a series of folders for the
2148c2ecf20Sopenharmony_ci individual test data and a set of summary pages in the root. The summary.html
2158c2ecf20Sopenharmony_ci file is a tabular list of the tests with relevant info and links. The
2168c2ecf20Sopenharmony_ci summary-issue.html and summary-devices.html files include data taken from
2178c2ecf20Sopenharmony_ci all tests on kernel issues and device performance. The folder looks like this:
2188c2ecf20Sopenharmony_ci
2198c2ecf20Sopenharmony_ci  suspend-xN-{date}-{time}:
2208c2ecf20Sopenharmony_ci	summary.html
2218c2ecf20Sopenharmony_ci	summary-issues.html
2228c2ecf20Sopenharmony_ci	summary-devices.html
2238c2ecf20Sopenharmony_ci	suspend-{date}-{time} (1)
2248c2ecf20Sopenharmony_ci	suspend-{date}-{time} (2)
2258c2ecf20Sopenharmony_ci	...
2268c2ecf20Sopenharmony_ci
2278c2ecf20Sopenharmony_ci These are the relevant arguments to use for testing:
2288c2ecf20Sopenharmony_ci
2298c2ecf20Sopenharmony_ci  -m mode
2308c2ecf20Sopenharmony_ci	Mode to initiate for suspend e.g. mem, freeze, standby (default: mem).
2318c2ecf20Sopenharmony_ci
2328c2ecf20Sopenharmony_ci  -rtcwake t
2338c2ecf20Sopenharmony_ci	Use rtcwake to autoresume after t seconds (default: 15).
2348c2ecf20Sopenharmony_ci
2358c2ecf20Sopenharmony_ci  -gzip (optional)
2368c2ecf20Sopenharmony_ci	Gzip the trace and dmesg logs to save space. The tool can also read in
2378c2ecf20Sopenharmony_ci	gzipped logs for processing. This reduces the multitest folder size.
2388c2ecf20Sopenharmony_ci
2398c2ecf20Sopenharmony_ci  -dev (optional)
2408c2ecf20Sopenharmony_ci	Add kernel source calls and threads to the timeline (default: disabled).
2418c2ecf20Sopenharmony_ci
2428c2ecf20Sopenharmony_ci  -multi n d
2438c2ecf20Sopenharmony_ci	Execute n consecutive tests at d seconds intervals. The outputs will be
2448c2ecf20Sopenharmony_ci	created in a new subdirectory: suspend-xN-{date}-{time}. When the multitest
2458c2ecf20Sopenharmony_ci	run is done, the -summary command is called automatically to create summary
2468c2ecf20Sopenharmony_ci	html files for all the data (unless you use -skiphtml). -skiphtml will
2478c2ecf20Sopenharmony_ci	speed up the testing by not creating timelines or summary html files. You
2488c2ecf20Sopenharmony_ci	can then run the tool again at a later time with -summary and -genhtml to
2498c2ecf20Sopenharmony_ci	create the timelines.
2508c2ecf20Sopenharmony_ci
2518c2ecf20Sopenharmony_ci  -skiphtml (optional)
2528c2ecf20Sopenharmony_ci	Run the test and capture the trace logs, but skip the timeline and summary
2538c2ecf20Sopenharmony_ci	html generation. This can greatly speed up overall testing. You can then
2548c2ecf20Sopenharmony_ci	copy the data to a faster host machine and run -summary -genhtml to
2558c2ecf20Sopenharmony_ci	generate the timelines and summary.
2568c2ecf20Sopenharmony_ci
2578c2ecf20Sopenharmony_ci These are the relevant commands to use after testing is complete:
2588c2ecf20Sopenharmony_ci
2598c2ecf20Sopenharmony_ci  -summary indir
2608c2ecf20Sopenharmony_ci	Generate or regenerate the summary for a -multi test run. Creates three
2618c2ecf20Sopenharmony_ci	files: summary.html, summary-issues.html, and summary-devices.html in the
2628c2ecf20Sopenharmony_ci	current folder. summary.html is a table of tests with relevant info sorted
2638c2ecf20Sopenharmony_ci	by kernel/host/mode, and links to the test html files. summary-issues.html
2648c2ecf20Sopenharmony_ci	is a list of kernel issues found in dmesg from all the tests.
2658c2ecf20Sopenharmony_ci	summary-devices.html is a list of devices and times from all the tests.
2668c2ecf20Sopenharmony_ci
2678c2ecf20Sopenharmony_ci  -genhtml
2688c2ecf20Sopenharmony_ci	Used  with -summary to regenerate any missing html timelines from their
2698c2ecf20Sopenharmony_ci	dmesg and ftrace logs. This will require a significant amount of time if
2708c2ecf20Sopenharmony_ci	there are thousands of tests.
2718c2ecf20Sopenharmony_ci
2728c2ecf20Sopenharmony_ciUsage Examples
2738c2ecf20Sopenharmony_ci_______________
2748c2ecf20Sopenharmony_ci
2758c2ecf20Sopenharmony_ci A multitest is initiated like this:
2768c2ecf20Sopenharmony_ci
2778c2ecf20Sopenharmony_ci  %> sudo ./sleepgraph.py -m mem -rtcwake 10 -dev -gzip -multi 2000 0
2788c2ecf20Sopenharmony_ci
2798c2ecf20Sopenharmony_ci	or you can skip timeline generation in order to speed things up
2808c2ecf20Sopenharmony_ci
2818c2ecf20Sopenharmony_ci  %> sudo ./sleepgraph.py -m mem -rtcwake 10 -dev -gzip -multi 2000 0 -skiphtml
2828c2ecf20Sopenharmony_ci
2838c2ecf20Sopenharmony_ci The tool will produce an output folder with all the test subfolders inside.
2848c2ecf20Sopenharmony_ci Each test subfolder contains the dmesg/ftrace logs and/or the html timeline
2858c2ecf20Sopenharmony_ci depending on whether you used the -skiphtml option. The root folder contains
2868c2ecf20Sopenharmony_ci the summary.html files.
2878c2ecf20Sopenharmony_ci
2888c2ecf20Sopenharmony_ci The summary for an existing multitest is generated like this:
2898c2ecf20Sopenharmony_ci
2908c2ecf20Sopenharmony_ci  %> cd suspend-x2000-{date}-{time}
2918c2ecf20Sopenharmony_ci  %> sleepgraph.py -summary .
2928c2ecf20Sopenharmony_ci
2938c2ecf20Sopenharmony_ci	or if you need to generate the html timelines you can use -genhtml
2948c2ecf20Sopenharmony_ci
2958c2ecf20Sopenharmony_ci  %> cd suspend-xN-{date}-{time}
2968c2ecf20Sopenharmony_ci  %> sleepgraph.py -summary . -genhtml
2978c2ecf20Sopenharmony_ci
2988c2ecf20Sopenharmony_ci------------------------------------------------------------------
2998c2ecf20Sopenharmony_ci|                    CONFIGURATION FILES                         |
3008c2ecf20Sopenharmony_ci------------------------------------------------------------------
3018c2ecf20Sopenharmony_ci
3028c2ecf20Sopenharmony_ci Since 4.0 we've moved to using config files in lieu of command line options.
3038c2ecf20Sopenharmony_ci The config folder contains a collection of typical use cases.
3048c2ecf20Sopenharmony_ci There are corresponding configs for other power modes:
3058c2ecf20Sopenharmony_ci
3068c2ecf20Sopenharmony_ci	Simple suspend/resume with basic timeline (mem/freeze/standby)
3078c2ecf20Sopenharmony_ci		config/suspend.cfg
3088c2ecf20Sopenharmony_ci		config/freeze.cfg
3098c2ecf20Sopenharmony_ci		config/standby.cfg
3108c2ecf20Sopenharmony_ci
3118c2ecf20Sopenharmony_ci	Dev mode suspend/resume with dev timeline (mem/freeze/standby)
3128c2ecf20Sopenharmony_ci		config/suspend-dev.cfg
3138c2ecf20Sopenharmony_ci		config/freeze-dev.cfg
3148c2ecf20Sopenharmony_ci		config/standby-dev.cfg
3158c2ecf20Sopenharmony_ci
3168c2ecf20Sopenharmony_ci	Simple suspend/resume with timeline and callgraph (mem/freeze/standby)
3178c2ecf20Sopenharmony_ci		config/suspend-callgraph.cfg
3188c2ecf20Sopenharmony_ci		config/freeze-callgraph.cfg
3198c2ecf20Sopenharmony_ci		config/standby-callgraph.cfg
3208c2ecf20Sopenharmony_ci
3218c2ecf20Sopenharmony_ci	Sample proc mode x2 run using mem suspend
3228c2ecf20Sopenharmony_ci		config/suspend-x2-proc.cfg
3238c2ecf20Sopenharmony_ci
3248c2ecf20Sopenharmony_ci	Sample for editing timeline funcs (moves internal functions into config)
3258c2ecf20Sopenharmony_ci		config/custom-timeline-functions.cfg
3268c2ecf20Sopenharmony_ci
3278c2ecf20Sopenharmony_ci	Sample debug config for serio subsystem
3288c2ecf20Sopenharmony_ci		config/debug-serio-suspend.cfg
3298c2ecf20Sopenharmony_ci
3308c2ecf20Sopenharmony_ci
3318c2ecf20Sopenharmony_ciUsage Examples
3328c2ecf20Sopenharmony_ci______________
3338c2ecf20Sopenharmony_ci
3348c2ecf20Sopenharmony_ci Run a simple mem suspend:
3358c2ecf20Sopenharmony_ci %> sudo ./sleepgraph.py -config config/suspend.cfg
3368c2ecf20Sopenharmony_ci
3378c2ecf20Sopenharmony_ci Run a mem suspend with callgraph data:
3388c2ecf20Sopenharmony_ci %> sudo ./sleepgraph.py -config config/suspend-callgraph.cfg
3398c2ecf20Sopenharmony_ci
3408c2ecf20Sopenharmony_ci Run a mem suspend with dev mode detail:
3418c2ecf20Sopenharmony_ci %> sudo ./sleepgraph.py -config config/suspend-dev.cfg
3428c2ecf20Sopenharmony_ci
3438c2ecf20Sopenharmony_ci
3448c2ecf20Sopenharmony_ciConfig File Options
3458c2ecf20Sopenharmony_ci___________________
3468c2ecf20Sopenharmony_ci
3478c2ecf20Sopenharmony_ci [Settings]
3488c2ecf20Sopenharmony_ci
3498c2ecf20Sopenharmony_ci # Verbosity: print verbose messages (def: false)
3508c2ecf20Sopenharmony_ci verbose: false
3518c2ecf20Sopenharmony_ci
3528c2ecf20Sopenharmony_ci # Suspend Mode: e.g. standby, mem, freeze, disk (def: mem)
3538c2ecf20Sopenharmony_ci mode: mem
3548c2ecf20Sopenharmony_ci
3558c2ecf20Sopenharmony_ci # Output Directory Format: {hostname}, {date}, {time} give current values
3568c2ecf20Sopenharmony_ci output-dir: suspend-{hostname}-{date}-{time}
3578c2ecf20Sopenharmony_ci
3588c2ecf20Sopenharmony_ci # Automatic Wakeup: use rtcwake to wakeup after X seconds (def: infinity)
3598c2ecf20Sopenharmony_ci rtcwake: 15
3608c2ecf20Sopenharmony_ci
3618c2ecf20Sopenharmony_ci # Add Logs: add the dmesg and ftrace log to the html output (def: false)
3628c2ecf20Sopenharmony_ci addlogs: false
3638c2ecf20Sopenharmony_ci
3648c2ecf20Sopenharmony_ci # Sus/Res Gap: insert a gap between sus & res in the timeline (def: false)
3658c2ecf20Sopenharmony_ci srgap: false
3668c2ecf20Sopenharmony_ci
3678c2ecf20Sopenharmony_ci # Custom Command: Command to execute in lieu of suspend (def: "")
3688c2ecf20Sopenharmony_ci command: echo mem > /sys/power/state
3698c2ecf20Sopenharmony_ci
3708c2ecf20Sopenharmony_ci # Proc mode: graph user processes and cpu usage in the timeline (def: false)
3718c2ecf20Sopenharmony_ci proc: false
3728c2ecf20Sopenharmony_ci
3738c2ecf20Sopenharmony_ci # Dev mode: graph source functions in the timeline (def: false)
3748c2ecf20Sopenharmony_ci dev: false
3758c2ecf20Sopenharmony_ci
3768c2ecf20Sopenharmony_ci # Suspend/Resume x2: run 2 suspend/resumes back to back (def: false)
3778c2ecf20Sopenharmony_ci x2: false
3788c2ecf20Sopenharmony_ci
3798c2ecf20Sopenharmony_ci # x2 Suspend Delay: time delay between the two test runs in ms (def: 0 ms)
3808c2ecf20Sopenharmony_ci x2delay: 0
3818c2ecf20Sopenharmony_ci
3828c2ecf20Sopenharmony_ci # Pre Suspend Delay: nclude an N ms delay before (1st) suspend (def: 0 ms)
3838c2ecf20Sopenharmony_ci predelay: 0
3848c2ecf20Sopenharmony_ci
3858c2ecf20Sopenharmony_ci # Post Resume Delay: include an N ms delay after (last) resume (def: 0 ms)
3868c2ecf20Sopenharmony_ci postdelay: 0
3878c2ecf20Sopenharmony_ci
3888c2ecf20Sopenharmony_ci # Min Device Length: graph only dev callbacks longer than min (def: 0.001 ms)
3898c2ecf20Sopenharmony_ci mindev: 0.001
3908c2ecf20Sopenharmony_ci
3918c2ecf20Sopenharmony_ci # Callgraph: gather ftrace callgraph data on all timeline events (def: false)
3928c2ecf20Sopenharmony_ci callgraph: false
3938c2ecf20Sopenharmony_ci
3948c2ecf20Sopenharmony_ci # Expand Callgraph: pre-expand the callgraph treeviews in html (def: false)
3958c2ecf20Sopenharmony_ci expandcg: false
3968c2ecf20Sopenharmony_ci
3978c2ecf20Sopenharmony_ci # Min Callgraph Length: show callgraphs only if longer than min (def: 1 ms)
3988c2ecf20Sopenharmony_ci mincg: 1
3998c2ecf20Sopenharmony_ci
4008c2ecf20Sopenharmony_ci # Timestamp Precision: number of sig digits in timestamps (0:S, [3:ms], 6:us)
4018c2ecf20Sopenharmony_ci timeprec: 3
4028c2ecf20Sopenharmony_ci
4038c2ecf20Sopenharmony_ci # Device Filter: show only devs whose name/driver includes one of these strings
4048c2ecf20Sopenharmony_ci devicefilter: _cpu_up,_cpu_down,i915,usb
4058c2ecf20Sopenharmony_ci
4068c2ecf20Sopenharmony_ci # Override default timeline entries:
4078c2ecf20Sopenharmony_ci # Do not use the internal default functions for timeline entries (def: false)
4088c2ecf20Sopenharmony_ci # Set this to true if you intend to only use the ones defined in the config
4098c2ecf20Sopenharmony_ci override-timeline-functions: true
4108c2ecf20Sopenharmony_ci
4118c2ecf20Sopenharmony_ci # Override default dev timeline entries:
4128c2ecf20Sopenharmony_ci # Do not use the internal default functions for dev timeline entries (def: false)
4138c2ecf20Sopenharmony_ci # Set this to true if you intend to only use the ones defined in the config
4148c2ecf20Sopenharmony_ci override-dev-timeline-functions: true
4158c2ecf20Sopenharmony_ci
4168c2ecf20Sopenharmony_ci # Call Loop Max Gap (dev mode only)
4178c2ecf20Sopenharmony_ci # merge loops of the same call if each is less than maxgap apart (def: 100us)
4188c2ecf20Sopenharmony_ci callloop-maxgap: 0.0001
4198c2ecf20Sopenharmony_ci
4208c2ecf20Sopenharmony_ci # Call Loop Max Length (dev mode only)
4218c2ecf20Sopenharmony_ci # merge loops of the same call if each is less than maxlen in length (def: 5ms)
4228c2ecf20Sopenharmony_ci callloop-maxlen: 0.005
4238c2ecf20Sopenharmony_ci
4248c2ecf20Sopenharmony_ci------------------------------------------------------------------
4258c2ecf20Sopenharmony_ci|                   CUSTOM TIMELINE ENTRIES                      |
4268c2ecf20Sopenharmony_ci------------------------------------------------------------------
4278c2ecf20Sopenharmony_ci
4288c2ecf20Sopenharmony_ciAdding or Editing Timeline Functions
4298c2ecf20Sopenharmony_ci____________________________________
4308c2ecf20Sopenharmony_ci
4318c2ecf20Sopenharmony_ci The tool uses an array of function names to fill out empty spaces in the
4328c2ecf20Sopenharmony_ci timeline where device callbacks don't appear. For instance, in suspend_prepare
4338c2ecf20Sopenharmony_ci the tool adds the sys_sync and freeze_processes calls as virtual device blocks
4348c2ecf20Sopenharmony_ci in the timeline to show you where the time is going. These calls should fill
4358c2ecf20Sopenharmony_ci the timeline with contiguous data so that most kernel execution is covered.
4368c2ecf20Sopenharmony_ci
4378c2ecf20Sopenharmony_ci It is possible to add new function calls to the timeline by adding them to
4388c2ecf20Sopenharmony_ci the config. It's also possible to copy the internal timeline functions into
4398c2ecf20Sopenharmony_ci the config so that you can override and edit them. Place them in the
4408c2ecf20Sopenharmony_ci timeline_functions_ARCH section with the name of your architecture appended.
4418c2ecf20Sopenharmony_ci i.e. for x86_64: [timeline_functions_x86_64]
4428c2ecf20Sopenharmony_ci
4438c2ecf20Sopenharmony_ci Use the override-timeline-functions option if you only want to use your
4448c2ecf20Sopenharmony_ci custom calls, or leave it false to append them to the internal ones.
4458c2ecf20Sopenharmony_ci
4468c2ecf20Sopenharmony_ci This section includes a list of functions (set using kprobes) which use both
4478c2ecf20Sopenharmony_ci symbol data and function arg data. The args are pulled directly from the
4488c2ecf20Sopenharmony_ci stack using this architecture's registers and stack formatting. Each entry
4498c2ecf20Sopenharmony_ci can include up to four pieces of info: The function name, a format string,
4508c2ecf20Sopenharmony_ci an argument list, and a color. But only a function name is required.
4518c2ecf20Sopenharmony_ci
4528c2ecf20Sopenharmony_ci For a full example config, see config/custom-timeline-functions.cfg. It pulls
4538c2ecf20Sopenharmony_ci all the internal timeline functions into the config and allows you to edit
4548c2ecf20Sopenharmony_ci them.
4558c2ecf20Sopenharmony_ci
4568c2ecf20Sopenharmony_ci  Entry format:
4578c2ecf20Sopenharmony_ci
4588c2ecf20Sopenharmony_ci    function: format{fn_arg1}_{fn_arg2} fn_arg1 fn_arg2 ... [color=purple]
4598c2ecf20Sopenharmony_ci
4608c2ecf20Sopenharmony_ci  Required Arguments:
4618c2ecf20Sopenharmony_ci
4628c2ecf20Sopenharmony_ci    function: The symbol name for the function you want probed, this is the
4638c2ecf20Sopenharmony_ci              minimum required for an entry, it will show up as the function
4648c2ecf20Sopenharmony_ci              name with no arguments.
4658c2ecf20Sopenharmony_ci
4668c2ecf20Sopenharmony_ci        example: _cpu_up:
4678c2ecf20Sopenharmony_ci
4688c2ecf20Sopenharmony_ci  Optional Arguments:
4698c2ecf20Sopenharmony_ci
4708c2ecf20Sopenharmony_ci    format: The format to display the data on the timeline in. Use braces to
4718c2ecf20Sopenharmony_ci            enclose the arg names.
4728c2ecf20Sopenharmony_ci
4738c2ecf20Sopenharmony_ci        example: CPU_ON[{cpu}]
4748c2ecf20Sopenharmony_ci
4758c2ecf20Sopenharmony_ci    color: The color of the entry block in the timeline. The default color is
4768c2ecf20Sopenharmony_ci           transparent, so the entry shares the phase color. The color is an
4778c2ecf20Sopenharmony_ci           html color string, either a word, or an RGB.
4788c2ecf20Sopenharmony_ci
4798c2ecf20Sopenharmony_ci        example: [color=#CC00CC]
4808c2ecf20Sopenharmony_ci
4818c2ecf20Sopenharmony_ci    arglist: A list of arguments from registers/stack addresses. See URL:
4828c2ecf20Sopenharmony_ci             https://www.kernel.org/doc/Documentation/trace/kprobetrace.txt
4838c2ecf20Sopenharmony_ci
4848c2ecf20Sopenharmony_ci        example: cpu=%di:s32
4858c2ecf20Sopenharmony_ci
4868c2ecf20Sopenharmony_ci Here is a full example entry. It displays cpu resume calls in the timeline
4878c2ecf20Sopenharmony_ci in orange. They will appear as CPU_ON[0], CPU_ON[1], etc.
4888c2ecf20Sopenharmony_ci
4898c2ecf20Sopenharmony_ci  [timeline_functions_x86_64]
4908c2ecf20Sopenharmony_ci  _cpu_up: CPU_ON[{cpu}] cpu=%di:s32 [color=orange]
4918c2ecf20Sopenharmony_ci
4928c2ecf20Sopenharmony_ci
4938c2ecf20Sopenharmony_ciAdding or Editing Dev Mode Timeline Source Functions
4948c2ecf20Sopenharmony_ci____________________________________________________
4958c2ecf20Sopenharmony_ci
4968c2ecf20Sopenharmony_ci In dev mode, the tool uses an array of function names to monitor source
4978c2ecf20Sopenharmony_ci execution within the timeline entries.
4988c2ecf20Sopenharmony_ci
4998c2ecf20Sopenharmony_ci The function calls are displayed inside the main device/call blocks in the
5008c2ecf20Sopenharmony_ci timeline. However, if a function call is not within a main timeline event,
5018c2ecf20Sopenharmony_ci it will spawn an entirely new event named after the caller's kernel thread.
5028c2ecf20Sopenharmony_ci These asynchronous kernel threads will populate in a separate section
5038c2ecf20Sopenharmony_ci beneath the main device/call section.
5048c2ecf20Sopenharmony_ci
5058c2ecf20Sopenharmony_ci The tool has a set of hard coded calls which focus on the most common use
5068c2ecf20Sopenharmony_ci cases: msleep, udelay, schedule_timeout, mutex_lock_slowpath, etc. These are
5078c2ecf20Sopenharmony_ci the functions that add a hardcoded time delay to the suspend/resume path.
5088c2ecf20Sopenharmony_ci The tool also includes some common functions native to important
5098c2ecf20Sopenharmony_ci subsystems: ata, i915, and ACPI, etc.
5108c2ecf20Sopenharmony_ci
5118c2ecf20Sopenharmony_ci It is possible to add new function calls to the dev timeline by adding them
5128c2ecf20Sopenharmony_ci to the config. It's also possible to copy the internal dev timeline
5138c2ecf20Sopenharmony_ci functions into the config so that you can override and edit them. Place them
5148c2ecf20Sopenharmony_ci in the dev_timeline_functions_ARCH section with the name of your architecture
5158c2ecf20Sopenharmony_ci appended. i.e. for x86_64: [dev_timeline_functions_x86_64]
5168c2ecf20Sopenharmony_ci
5178c2ecf20Sopenharmony_ci Use the override-dev-timeline-functions option if you only want to use your
5188c2ecf20Sopenharmony_ci custom calls, or leave it false to append them to the internal ones.
5198c2ecf20Sopenharmony_ci
5208c2ecf20Sopenharmony_ci The format is the same as the timeline_functions_x86_64 section. It's a
5218c2ecf20Sopenharmony_ci list of functions (set using kprobes) which use both symbol data and function
5228c2ecf20Sopenharmony_ci arg data. The args are pulled directly from the stack using this
5238c2ecf20Sopenharmony_ci architecture's registers and stack formatting. Each entry can include up
5248c2ecf20Sopenharmony_ci to four pieces of info: The function name, a format string, an argument list,
5258c2ecf20Sopenharmony_ci and a color. But only the function name is required.
5268c2ecf20Sopenharmony_ci
5278c2ecf20Sopenharmony_ci For a full example config, see config/custom-timeline-functions.cfg. It pulls
5288c2ecf20Sopenharmony_ci all the internal dev timeline functions into the config and allows you to edit
5298c2ecf20Sopenharmony_ci them.
5308c2ecf20Sopenharmony_ci
5318c2ecf20Sopenharmony_ci Here is a full example entry. It displays the ATA port reset calls as
5328c2ecf20Sopenharmony_ci ataN_port_reset in the timeline. This is where most of the SATA disk resume
5338c2ecf20Sopenharmony_ci time goes, so it can be helpful to see the low level call.
5348c2ecf20Sopenharmony_ci
5358c2ecf20Sopenharmony_ci  [dev_timeline_functions_x86_64]
5368c2ecf20Sopenharmony_ci  ata_eh_recover: ata{port}_port_reset port=+36(%di):s32 [color=#CC00CC]
5378c2ecf20Sopenharmony_ci
5388c2ecf20Sopenharmony_ci
5398c2ecf20Sopenharmony_ciVerifying your custom functions
5408c2ecf20Sopenharmony_ci_______________________________
5418c2ecf20Sopenharmony_ci
5428c2ecf20Sopenharmony_ci Once you have a set of functions (kprobes) defined, it can be useful to
5438c2ecf20Sopenharmony_ci perform a quick check to see if you formatted them correctly and if the system
5448c2ecf20Sopenharmony_ci actually supports them. To do this, run the tool with your config file
5458c2ecf20Sopenharmony_ci and the -status option. The tool will go through all the kprobes (both
5468c2ecf20Sopenharmony_ci custom and internal if you haven't overridden them) and actually attempts
5478c2ecf20Sopenharmony_ci to set them in ftrace. It will then print out success or fail for you.
5488c2ecf20Sopenharmony_ci
5498c2ecf20Sopenharmony_ci Note that kprobes which don't actually exist in the kernel won't stop the
5508c2ecf20Sopenharmony_ci tool, they just wont show up.
5518c2ecf20Sopenharmony_ci
5528c2ecf20Sopenharmony_ci For example:
5538c2ecf20Sopenharmony_ci
5548c2ecf20Sopenharmony_ci sudo ./sleepgraph.py -config config/custom-timeline-functions.cfg -status
5558c2ecf20Sopenharmony_ci Checking this system (myhostname)...
5568c2ecf20Sopenharmony_ci    have root access: YES
5578c2ecf20Sopenharmony_ci    is sysfs mounted: YES
5588c2ecf20Sopenharmony_ci    is "mem" a valid power mode: YES
5598c2ecf20Sopenharmony_ci    is ftrace supported: YES
5608c2ecf20Sopenharmony_ci    are kprobes supported: YES
5618c2ecf20Sopenharmony_ci    timeline data source: FTRACE (all trace events found)
5628c2ecf20Sopenharmony_ci    is rtcwake supported: YES
5638c2ecf20Sopenharmony_ci    verifying timeline kprobes work:
5648c2ecf20Sopenharmony_ci         _cpu_down: YES
5658c2ecf20Sopenharmony_ci         _cpu_up: YES
5668c2ecf20Sopenharmony_ci         acpi_pm_finish: YES
5678c2ecf20Sopenharmony_ci         acpi_pm_prepare: YES
5688c2ecf20Sopenharmony_ci         freeze_kernel_threads: YES
5698c2ecf20Sopenharmony_ci         freeze_processes: YES
5708c2ecf20Sopenharmony_ci         sys_sync: YES
5718c2ecf20Sopenharmony_ci         thaw_processes: YES
5728c2ecf20Sopenharmony_ci    verifying dev kprobes work:
5738c2ecf20Sopenharmony_ci         __const_udelay: YES
5748c2ecf20Sopenharmony_ci         __mutex_lock_slowpath: YES
5758c2ecf20Sopenharmony_ci         acpi_os_stall: YES
5768c2ecf20Sopenharmony_ci         acpi_ps_parse_aml: YES
5778c2ecf20Sopenharmony_ci         intel_opregion_init: NO
5788c2ecf20Sopenharmony_ci         intel_opregion_register: NO
5798c2ecf20Sopenharmony_ci         intel_opregion_setup: NO
5808c2ecf20Sopenharmony_ci         msleep: YES
5818c2ecf20Sopenharmony_ci         schedule_timeout: YES
5828c2ecf20Sopenharmony_ci         schedule_timeout_uninterruptible: YES
5838c2ecf20Sopenharmony_ci         usleep_range: YES
5848c2ecf20Sopenharmony_ci
5858c2ecf20Sopenharmony_ci
5868c2ecf20Sopenharmony_ci------------------------------------------------------------------
5878c2ecf20Sopenharmony_ci|           TESTING ON CONSUMER LINUX OPERATING SYSTEMS          |
5888c2ecf20Sopenharmony_ci------------------------------------------------------------------
5898c2ecf20Sopenharmony_ci
5908c2ecf20Sopenharmony_ciAndroid
5918c2ecf20Sopenharmony_ci_______
5928c2ecf20Sopenharmony_ci
5938c2ecf20Sopenharmony_ci The easiest way to execute on an android device is to run the android.sh
5948c2ecf20Sopenharmony_ci script on the device, then pull the ftrace log back to the host and run
5958c2ecf20Sopenharmony_ci sleepgraph.py on it.
5968c2ecf20Sopenharmony_ci
5978c2ecf20Sopenharmony_ci Here are the steps:
5988c2ecf20Sopenharmony_ci
5998c2ecf20Sopenharmony_ci [download and install the tool on the device]
6008c2ecf20Sopenharmony_ci
6018c2ecf20Sopenharmony_ci	host%> wget https://raw.githubusercontent.com/intel/pm-graph/master/tools/android.sh
6028c2ecf20Sopenharmony_ci	host%> adb connect 192.168.1.6
6038c2ecf20Sopenharmony_ci	host%> adb root
6048c2ecf20Sopenharmony_ci	# push the script to a writeable location
6058c2ecf20Sopenharmony_ci	host%> adb push android.sh /sdcard/
6068c2ecf20Sopenharmony_ci
6078c2ecf20Sopenharmony_ci [check whether the tool will run on your device]
6088c2ecf20Sopenharmony_ci
6098c2ecf20Sopenharmony_ci	host%> adb shell
6108c2ecf20Sopenharmony_ci	dev%> cd /sdcard
6118c2ecf20Sopenharmony_ci	dev%> sh android.sh status
6128c2ecf20Sopenharmony_ci		host    : asus_t100
6138c2ecf20Sopenharmony_ci		kernel  : 3.14.0-i386-dirty
6148c2ecf20Sopenharmony_ci		modes   : freeze mem
6158c2ecf20Sopenharmony_ci		rtcwake : supported
6168c2ecf20Sopenharmony_ci		ftrace  : supported
6178c2ecf20Sopenharmony_ci		trace events {
6188c2ecf20Sopenharmony_ci		    suspend_resume: found
6198c2ecf20Sopenharmony_ci		    device_pm_callback_end: found
6208c2ecf20Sopenharmony_ci		    device_pm_callback_start: found
6218c2ecf20Sopenharmony_ci		}
6228c2ecf20Sopenharmony_ci	# the above is what you see on a system that's properly patched
6238c2ecf20Sopenharmony_ci
6248c2ecf20Sopenharmony_ci [execute the suspend]
6258c2ecf20Sopenharmony_ci
6268c2ecf20Sopenharmony_ci	# NOTE: The suspend will only work if the screen isn't timed out,
6278c2ecf20Sopenharmony_ci	# so you have to press some keys first to wake it up b4 suspend)
6288c2ecf20Sopenharmony_ci	dev%> sh android.sh suspend mem
6298c2ecf20Sopenharmony_ci	------------------------------------
6308c2ecf20Sopenharmony_ci	Suspend/Resume timing test initiated
6318c2ecf20Sopenharmony_ci	------------------------------------
6328c2ecf20Sopenharmony_ci	hostname   : asus_t100
6338c2ecf20Sopenharmony_ci	kernel     : 3.14.0-i386-dirty
6348c2ecf20Sopenharmony_ci	mode       : mem
6358c2ecf20Sopenharmony_ci	ftrace out : /mnt/shell/emulated/0/ftrace.txt
6368c2ecf20Sopenharmony_ci	dmesg out  : /mnt/shell/emulated/0/dmesg.txt
6378c2ecf20Sopenharmony_ci	log file   : /mnt/shell/emulated/0/log.txt
6388c2ecf20Sopenharmony_ci	------------------------------------
6398c2ecf20Sopenharmony_ci	INITIALIZING FTRACE........DONE
6408c2ecf20Sopenharmony_ci	STARTING FTRACE
6418c2ecf20Sopenharmony_ci	SUSPEND START @ 21:24:02 (rtcwake in 10 seconds)
6428c2ecf20Sopenharmony_ci	<adb connection will now terminate>
6438c2ecf20Sopenharmony_ci
6448c2ecf20Sopenharmony_ci [retrieve the data from the device]
6458c2ecf20Sopenharmony_ci
6468c2ecf20Sopenharmony_ci	# I find that you have to actually kill the adb process and
6478c2ecf20Sopenharmony_ci	# reconnect sometimes in order for the connection to work post-suspend
6488c2ecf20Sopenharmony_ci	host%> adb connect 192.168.1.6
6498c2ecf20Sopenharmony_ci	# (required) get the ftrace data, this is the most important piece
6508c2ecf20Sopenharmony_ci	host%> adb pull /sdcard/ftrace.txt
6518c2ecf20Sopenharmony_ci	# (optional) get the dmesg data, this is for debugging
6528c2ecf20Sopenharmony_ci	host%> adb pull /sdcard/dmesg.txt
6538c2ecf20Sopenharmony_ci	# (optional) get the log, which just lists some test times for comparison
6548c2ecf20Sopenharmony_ci	host%> adb pull /sdcard/log.txt
6558c2ecf20Sopenharmony_ci
6568c2ecf20Sopenharmony_ci [create an output html file using sleepgraph.py]
6578c2ecf20Sopenharmony_ci
6588c2ecf20Sopenharmony_ci	host%> sleepgraph.py -ftrace ftrace.txt
6598c2ecf20Sopenharmony_ci
6608c2ecf20Sopenharmony_ci You should now have an output.html with the android data, enjoy!
661