README 24 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660
  1. _
  2. _ __ _ __ ___ __ _ _ __ __ _ _ __ | |__
  3. | '_ \| '_ ` _ \ _____ / _` | '__/ _` | '_ \| '_ \
  4. | |_) | | | | | |_____| (_| | | | (_| | |_) | | | |
  5. | .__/|_| |_| |_| \__, |_| \__,_| .__/|_| |_|
  6. |_| |___/ |_|
  7. pm-graph: suspend/resume/boot timing analysis tools
  8. Version: 5.11
  9. Author: Todd Brandt <todd.e.brandt@intel.com>
  10. Home Page: https://www.intel.com/content/www/us/en/developer/topic-technology/open/pm-graph/overview.html
  11. Report bugs/issues at bugzilla.kernel.org Tools/pm-graph
  12. - https://bugzilla.kernel.org/buglist.cgi?component=pm-graph&product=Tools
  13. Full documentation available online & in man pages
  14. - Getting Started:
  15. https://www.intel.com/content/www/us/en/developer/articles/technical/usage.html
  16. - Feature Summary:
  17. https://www.intel.com/content/www/us/en/developer/topic-technology/open/pm-graph/features.html
  18. - upstream version in git:
  19. git clone https://github.com/intel/pm-graph/
  20. Table of Contents
  21. - Overview
  22. - Setup
  23. - Usage
  24. - Basic Usage
  25. - Dev Mode Usage
  26. - Proc Mode Usage
  27. - Endurance Testing
  28. - Usage Examples
  29. - Configuration Files
  30. - Usage Examples
  31. - Config File Options
  32. - Custom Timeline Entries
  33. - Adding/Editing Timeline Functions
  34. - Adding/Editing Dev Timeline Source Functions
  35. - Verifying your Custom Functions
  36. - Testing on consumer linux Operating Systems
  37. - Android
  38. ------------------------------------------------------------------
  39. | OVERVIEW |
  40. ------------------------------------------------------------------
  41. This tool suite is designed to assist kernel and OS developers in optimizing
  42. their linux stack's suspend/resume & boot time. Using a kernel image built
  43. with a few extra options enabled, the tools will execute a suspend or boot,
  44. and will capture dmesg and ftrace data. This data is transformed into a set of
  45. timelines and a callgraph to give a quick and detailed view of which devices
  46. and kernel processes are taking the most time in suspend/resume & boot.
  47. ------------------------------------------------------------------
  48. | SETUP |
  49. ------------------------------------------------------------------
  50. Package Requirements
  51. - runs with python2 or python3, choice is made by /usr/bin/python link
  52. - python
  53. - python-configparser (for python2 sleepgraph)
  54. - python-requests (for stresstester.py)
  55. - linux-tools-common (for turbostat usage in sleepgraph)
  56. Ubuntu:
  57. sudo apt-get install python python-configparser python-requests linux-tools-common
  58. Fedora:
  59. sudo dnf install python python-configparser python-requests linux-tools-common
  60. The tools can most easily be installed via git clone and make install
  61. $> git clone http://github.com/intel/pm-graph.git
  62. $> cd pm-graph
  63. $> sudo make install
  64. $> man sleepgraph ; man bootgraph
  65. Setup involves some minor kernel configuration
  66. The following kernel build options are required for all kernels:
  67. CONFIG_DEVMEM=y
  68. CONFIG_PM_DEBUG=y
  69. CONFIG_PM_SLEEP_DEBUG=y
  70. CONFIG_FTRACE=y
  71. CONFIG_FUNCTION_TRACER=y
  72. CONFIG_FUNCTION_GRAPH_TRACER=y
  73. CONFIG_KPROBES=y
  74. CONFIG_KPROBES_ON_FTRACE=y
  75. In kernel 3.15.0, two patches were upstreamed which enable the
  76. v3.0 behavior. These patches allow the tool to read all the
  77. data from trace events instead of from dmesg. You can enable
  78. this behavior on earlier kernels with these patches:
  79. (kernel/pre-3.15/enable_trace_events_suspend_resume.patch)
  80. (kernel/pre-3.15/enable_trace_events_device_pm_callback.patch)
  81. If you're using bootgraph, or sleepgraph with a kernel older than 3.15.0,
  82. the following additional kernel parameters are required:
  83. (e.g. in file /etc/default/grub)
  84. GRUB_CMDLINE_LINUX_DEFAULT="... initcall_debug log_buf_len=32M ..."
  85. If you're using a kernel older than 3.11-rc2, the following simple
  86. patch must be applied to enable ftrace data:
  87. in file: kernel/power/suspend.c
  88. in function: int suspend_devices_and_enter(suspend_state_t state)
  89. remove call to "ftrace_stop();"
  90. remove call to "ftrace_start();"
  91. There is a patch which does this for kernel v3.8.0:
  92. (kernel/pre-3.11-rc2/enable_ftrace_in_suspendresume.patch)
  93. ------------------------------------------------------------------
  94. | USAGE |
  95. ------------------------------------------------------------------
  96. Basic Usage
  97. ___________
  98. 1) First configure a kernel using the instructions from the previous sections.
  99. Then build, install, and boot with it.
  100. 2) Open up a terminal window and execute the mode list command:
  101. %> sudo ./sleepgraph.py -modes
  102. ['freeze', 'mem', 'disk']
  103. Execute a test using one of the available power modes, e.g. mem (S3):
  104. %> sudo ./sleepgraph.py -m mem -rtcwake 15
  105. or with a config file
  106. %> sudo ./sleepgraph.py -config config/suspend.cfg
  107. When the system comes back you'll see the script finishing up and
  108. creating the output files in the test subdir. It generates output
  109. files in subdirectory: suspend-mmddyy-HHMMSS. The ftrace file can
  110. be used to regenerate the html timeline with different options
  111. HTML output: <hostname>_<mode>.html
  112. raw dmesg output: <hostname>_<mode>_dmesg.txt
  113. raw ftrace output: <hostname>_<mode>_ftrace.txt
  114. View the html in firefox or chrome.
  115. Dev Mode Usage
  116. ______________
  117. Developer mode adds information on low level source calls to the timeline.
  118. The tool sets kprobes on all delay and mutex calls to see which devices
  119. are waiting for something and when. It also sets a suite of kprobes on
  120. subsystem dependent calls to better fill out the timeline.
  121. The tool will also expose kernel threads that don't normally show up in the
  122. timeline. This is useful in discovering dependent threads to get a better
  123. idea of what each device is waiting for. For instance, the scsi_eh thread,
  124. a.k.a. scsi resume error handler, is what each SATA disk device waits for
  125. before it can continue resume.
  126. The timeline will be much larger if run with dev mode, so it can be useful
  127. to set the -mindev option to clip out any device blocks that are too small
  128. to see easily. The following command will give a nice dev mode run:
  129. %> sudo ./sleepgraph.py -m mem -rtcwake 15 -mindev 1 -dev
  130. or with a config file
  131. %> sudo ./sleepgraph.py -config config/suspend-dev.cfg
  132. Proc Mode Usage
  133. _______________
  134. Proc mode adds user process info to the timeline. This is done in a manner
  135. similar to the bootchart utility, which graphs init processes and their
  136. execution as the system boots. This tool option does the same thing but for
  137. the period before and after suspend/resume.
  138. In order to see any process info, there needs to be some delay before or
  139. after resume since processes are frozen in suspend_prepare and thawed in
  140. resume_complete. The predelay and postdelay args allow you to do this. It
  141. can also be useful to run in x2 mode with an x2 delay, this way you can
  142. see process activity before and after resume, and in between two
  143. successive suspend/resumes.
  144. The command can be run like this:
  145. %> sudo ./sleepgraph.py -m mem -rtcwake 15 -x2 -x2delay 1000 -predelay 1000 -postdelay 1000 -proc
  146. or with a config file
  147. %> sudo ./sleepgraph.py -config config/suspend-proc.cfg
  148. ------------------------------------------------------------------
  149. | ENDURANCE TESTING |
  150. ------------------------------------------------------------------
  151. The best way to gauge the health of a system is to run a series of
  152. suspend/resumes over an extended period and analyze the behavior. This can be
  153. accomplished with sleepgraph's -multi argument. You specify two numbers: the
  154. number of tests to run OR the duration in days, hours, or minutes, and the
  155. delay in seconds between them. For instance, -multi 20 5: execute 20 tests with
  156. a 5 second delay between each, or -multi 24h 0: execute tests over a 24 hour
  157. period with no delay between tests. You can include any other options you like
  158. to generate the data you want. It's most useful to collect dev mode timelines
  159. as the kprobes don't alter the performance much and you get more insight.
  160. On completion, the output folder contains a series of folders for the
  161. individual test data and a set of summary pages in the root. The summary.html
  162. file is a tabular list of the tests with relevant info and links. The
  163. summary-issue.html and summary-devices.html files include data taken from
  164. all tests on kernel issues and device performance. The folder looks like this:
  165. suspend-xN-{date}-{time}:
  166. summary.html
  167. summary-issues.html
  168. summary-devices.html
  169. suspend-{date}-{time} (1)
  170. suspend-{date}-{time} (2)
  171. ...
  172. These are the relevant arguments to use for testing:
  173. -m mode
  174. Mode to initiate for suspend e.g. mem, freeze, standby (default: mem).
  175. -rtcwake t
  176. Use rtcwake to autoresume after t seconds (default: 15).
  177. -gzip (optional)
  178. Gzip the trace and dmesg logs to save space. The tool can also read in
  179. gzipped logs for processing. This reduces the multitest folder size.
  180. -dev (optional)
  181. Add kernel source calls and threads to the timeline (default: disabled).
  182. -multi n d
  183. Execute n consecutive tests at d seconds intervals. The outputs will be
  184. created in a new subdirectory: suspend-xN-{date}-{time}. When the multitest
  185. run is done, the -summary command is called automatically to create summary
  186. html files for all the data (unless you use -skiphtml). -skiphtml will
  187. speed up the testing by not creating timelines or summary html files. You
  188. can then run the tool again at a later time with -summary and -genhtml to
  189. create the timelines.
  190. -skiphtml (optional)
  191. Run the test and capture the trace logs, but skip the timeline and summary
  192. html generation. This can greatly speed up overall testing. You can then
  193. copy the data to a faster host machine and run -summary -genhtml to
  194. generate the timelines and summary.
  195. These are the relevant commands to use after testing is complete:
  196. -summary indir
  197. Generate or regenerate the summary for a -multi test run. Creates three
  198. files: summary.html, summary-issues.html, and summary-devices.html in the
  199. current folder. summary.html is a table of tests with relevant info sorted
  200. by kernel/host/mode, and links to the test html files. summary-issues.html
  201. is a list of kernel issues found in dmesg from all the tests.
  202. summary-devices.html is a list of devices and times from all the tests.
  203. -genhtml
  204. Used with -summary to regenerate any missing html timelines from their
  205. dmesg and ftrace logs. This will require a significant amount of time if
  206. there are thousands of tests.
  207. Usage Examples
  208. _______________
  209. A multitest is initiated like this:
  210. %> sudo ./sleepgraph.py -m mem -rtcwake 10 -dev -gzip -multi 2000 0
  211. or you can skip timeline generation in order to speed things up
  212. %> sudo ./sleepgraph.py -m mem -rtcwake 10 -dev -gzip -multi 2000 0 -skiphtml
  213. The tool will produce an output folder with all the test subfolders inside.
  214. Each test subfolder contains the dmesg/ftrace logs and/or the html timeline
  215. depending on whether you used the -skiphtml option. The root folder contains
  216. the summary.html files.
  217. The summary for an existing multitest is generated like this:
  218. %> cd suspend-x2000-{date}-{time}
  219. %> sleepgraph.py -summary .
  220. or if you need to generate the html timelines you can use -genhtml
  221. %> cd suspend-xN-{date}-{time}
  222. %> sleepgraph.py -summary . -genhtml
  223. ------------------------------------------------------------------
  224. | CONFIGURATION FILES |
  225. ------------------------------------------------------------------
  226. Since 4.0 we've moved to using config files in lieu of command line options.
  227. The config folder contains a collection of typical use cases.
  228. There are corresponding configs for other power modes:
  229. Simple suspend/resume with basic timeline (mem/freeze/standby)
  230. config/suspend.cfg
  231. config/freeze.cfg
  232. config/standby.cfg
  233. Dev mode suspend/resume with dev timeline (mem/freeze/standby)
  234. config/suspend-dev.cfg
  235. config/freeze-dev.cfg
  236. config/standby-dev.cfg
  237. Simple suspend/resume with timeline and callgraph (mem/freeze/standby)
  238. config/suspend-callgraph.cfg
  239. config/freeze-callgraph.cfg
  240. config/standby-callgraph.cfg
  241. Sample proc mode x2 run using mem suspend
  242. config/suspend-x2-proc.cfg
  243. Sample for editing timeline funcs (moves internal functions into config)
  244. config/custom-timeline-functions.cfg
  245. Sample debug config for serio subsystem
  246. config/debug-serio-suspend.cfg
  247. Usage Examples
  248. ______________
  249. Run a simple mem suspend:
  250. %> sudo ./sleepgraph.py -config config/suspend.cfg
  251. Run a mem suspend with callgraph data:
  252. %> sudo ./sleepgraph.py -config config/suspend-callgraph.cfg
  253. Run a mem suspend with dev mode detail:
  254. %> sudo ./sleepgraph.py -config config/suspend-dev.cfg
  255. Config File Options
  256. ___________________
  257. [Settings]
  258. # Verbosity: print verbose messages (def: false)
  259. verbose: false
  260. # Suspend Mode: e.g. standby, mem, freeze, disk (def: mem)
  261. mode: mem
  262. # Output Directory Format: {hostname}, {date}, {time} give current values
  263. output-dir: suspend-{hostname}-{date}-{time}
  264. # Automatic Wakeup: use rtcwake to wakeup after X seconds (def: infinity)
  265. rtcwake: 15
  266. # Add Logs: add the dmesg and ftrace log to the html output (def: false)
  267. addlogs: false
  268. # Sus/Res Gap: insert a gap between sus & res in the timeline (def: false)
  269. srgap: false
  270. # Custom Command: Command to execute in lieu of suspend (def: "")
  271. command: echo mem > /sys/power/state
  272. # Proc mode: graph user processes and cpu usage in the timeline (def: false)
  273. proc: false
  274. # Dev mode: graph source functions in the timeline (def: false)
  275. dev: false
  276. # Suspend/Resume x2: run 2 suspend/resumes back to back (def: false)
  277. x2: false
  278. # x2 Suspend Delay: time delay between the two test runs in ms (def: 0 ms)
  279. x2delay: 0
  280. # Pre Suspend Delay: nclude an N ms delay before (1st) suspend (def: 0 ms)
  281. predelay: 0
  282. # Post Resume Delay: include an N ms delay after (last) resume (def: 0 ms)
  283. postdelay: 0
  284. # Min Device Length: graph only dev callbacks longer than min (def: 0.001 ms)
  285. mindev: 0.001
  286. # Callgraph: gather ftrace callgraph data on all timeline events (def: false)
  287. callgraph: false
  288. # Expand Callgraph: pre-expand the callgraph treeviews in html (def: false)
  289. expandcg: false
  290. # Min Callgraph Length: show callgraphs only if longer than min (def: 1 ms)
  291. mincg: 1
  292. # Timestamp Precision: number of sig digits in timestamps (0:S, [3:ms], 6:us)
  293. timeprec: 3
  294. # Device Filter: show only devs whose name/driver includes one of these strings
  295. devicefilter: _cpu_up,_cpu_down,i915,usb
  296. # Override default timeline entries:
  297. # Do not use the internal default functions for timeline entries (def: false)
  298. # Set this to true if you intend to only use the ones defined in the config
  299. override-timeline-functions: true
  300. # Override default dev timeline entries:
  301. # Do not use the internal default functions for dev timeline entries (def: false)
  302. # Set this to true if you intend to only use the ones defined in the config
  303. override-dev-timeline-functions: true
  304. # Call Loop Max Gap (dev mode only)
  305. # merge loops of the same call if each is less than maxgap apart (def: 100us)
  306. callloop-maxgap: 0.0001
  307. # Call Loop Max Length (dev mode only)
  308. # merge loops of the same call if each is less than maxlen in length (def: 5ms)
  309. callloop-maxlen: 0.005
  310. ------------------------------------------------------------------
  311. | CUSTOM TIMELINE ENTRIES |
  312. ------------------------------------------------------------------
  313. Adding or Editing Timeline Functions
  314. ____________________________________
  315. The tool uses an array of function names to fill out empty spaces in the
  316. timeline where device callbacks don't appear. For instance, in suspend_prepare
  317. the tool adds the sys_sync and freeze_processes calls as virtual device blocks
  318. in the timeline to show you where the time is going. These calls should fill
  319. the timeline with contiguous data so that most kernel execution is covered.
  320. It is possible to add new function calls to the timeline by adding them to
  321. the config. It's also possible to copy the internal timeline functions into
  322. the config so that you can override and edit them. Place them in the
  323. timeline_functions_ARCH section with the name of your architecture appended.
  324. i.e. for x86_64: [timeline_functions_x86_64]
  325. Use the override-timeline-functions option if you only want to use your
  326. custom calls, or leave it false to append them to the internal ones.
  327. This section includes a list of functions (set using kprobes) which use both
  328. symbol data and function arg data. The args are pulled directly from the
  329. stack using this architecture's registers and stack formatting. Each entry
  330. can include up to four pieces of info: The function name, a format string,
  331. an argument list, and a color. But only a function name is required.
  332. For a full example config, see config/custom-timeline-functions.cfg. It pulls
  333. all the internal timeline functions into the config and allows you to edit
  334. them.
  335. Entry format:
  336. function: format{fn_arg1}_{fn_arg2} fn_arg1 fn_arg2 ... [color=purple]
  337. Required Arguments:
  338. function: The symbol name for the function you want probed, this is the
  339. minimum required for an entry, it will show up as the function
  340. name with no arguments.
  341. example: _cpu_up:
  342. Optional Arguments:
  343. format: The format to display the data on the timeline in. Use braces to
  344. enclose the arg names.
  345. example: CPU_ON[{cpu}]
  346. color: The color of the entry block in the timeline. The default color is
  347. transparent, so the entry shares the phase color. The color is an
  348. html color string, either a word, or an RGB.
  349. example: [color=#CC00CC]
  350. arglist: A list of arguments from registers/stack addresses. See URL:
  351. https://www.kernel.org/doc/Documentation/trace/kprobetrace.txt
  352. example: cpu=%di:s32
  353. Here is a full example entry. It displays cpu resume calls in the timeline
  354. in orange. They will appear as CPU_ON[0], CPU_ON[1], etc.
  355. [timeline_functions_x86_64]
  356. _cpu_up: CPU_ON[{cpu}] cpu=%di:s32 [color=orange]
  357. Adding or Editing Dev Mode Timeline Source Functions
  358. ____________________________________________________
  359. In dev mode, the tool uses an array of function names to monitor source
  360. execution within the timeline entries.
  361. The function calls are displayed inside the main device/call blocks in the
  362. timeline. However, if a function call is not within a main timeline event,
  363. it will spawn an entirely new event named after the caller's kernel thread.
  364. These asynchronous kernel threads will populate in a separate section
  365. beneath the main device/call section.
  366. The tool has a set of hard coded calls which focus on the most common use
  367. cases: msleep, udelay, schedule_timeout, mutex_lock_slowpath, etc. These are
  368. the functions that add a hardcoded time delay to the suspend/resume path.
  369. The tool also includes some common functions native to important
  370. subsystems: ata, i915, and ACPI, etc.
  371. It is possible to add new function calls to the dev timeline by adding them
  372. to the config. It's also possible to copy the internal dev timeline
  373. functions into the config so that you can override and edit them. Place them
  374. in the dev_timeline_functions_ARCH section with the name of your architecture
  375. appended. i.e. for x86_64: [dev_timeline_functions_x86_64]
  376. Use the override-dev-timeline-functions option if you only want to use your
  377. custom calls, or leave it false to append them to the internal ones.
  378. The format is the same as the timeline_functions_x86_64 section. It's a
  379. list of functions (set using kprobes) which use both symbol data and function
  380. arg data. The args are pulled directly from the stack using this
  381. architecture's registers and stack formatting. Each entry can include up
  382. to four pieces of info: The function name, a format string, an argument list,
  383. and a color. But only the function name is required.
  384. For a full example config, see config/custom-timeline-functions.cfg. It pulls
  385. all the internal dev timeline functions into the config and allows you to edit
  386. them.
  387. Here is a full example entry. It displays the ATA port reset calls as
  388. ataN_port_reset in the timeline. This is where most of the SATA disk resume
  389. time goes, so it can be helpful to see the low level call.
  390. [dev_timeline_functions_x86_64]
  391. ata_eh_recover: ata{port}_port_reset port=+36(%di):s32 [color=#CC00CC]
  392. Verifying your custom functions
  393. _______________________________
  394. Once you have a set of functions (kprobes) defined, it can be useful to
  395. perform a quick check to see if you formatted them correctly and if the system
  396. actually supports them. To do this, run the tool with your config file
  397. and the -status option. The tool will go through all the kprobes (both
  398. custom and internal if you haven't overridden them) and actually attempts
  399. to set them in ftrace. It will then print out success or fail for you.
  400. Note that kprobes which don't actually exist in the kernel won't stop the
  401. tool, they just wont show up.
  402. For example:
  403. sudo ./sleepgraph.py -config config/custom-timeline-functions.cfg -status
  404. Checking this system (myhostname)...
  405. have root access: YES
  406. is sysfs mounted: YES
  407. is "mem" a valid power mode: YES
  408. is ftrace supported: YES
  409. are kprobes supported: YES
  410. timeline data source: FTRACE (all trace events found)
  411. is rtcwake supported: YES
  412. verifying timeline kprobes work:
  413. _cpu_down: YES
  414. _cpu_up: YES
  415. acpi_pm_finish: YES
  416. acpi_pm_prepare: YES
  417. freeze_kernel_threads: YES
  418. freeze_processes: YES
  419. sys_sync: YES
  420. thaw_processes: YES
  421. verifying dev kprobes work:
  422. __const_udelay: YES
  423. __mutex_lock_slowpath: YES
  424. acpi_os_stall: YES
  425. acpi_ps_parse_aml: YES
  426. intel_opregion_init: NO
  427. intel_opregion_register: NO
  428. intel_opregion_setup: NO
  429. msleep: YES
  430. schedule_timeout: YES
  431. schedule_timeout_uninterruptible: YES
  432. usleep_range: YES
  433. ------------------------------------------------------------------
  434. | TESTING ON CONSUMER LINUX OPERATING SYSTEMS |
  435. ------------------------------------------------------------------
  436. Android
  437. _______
  438. The easiest way to execute on an android device is to run the android.sh
  439. script on the device, then pull the ftrace log back to the host and run
  440. sleepgraph.py on it.
  441. Here are the steps:
  442. [download and install the tool on the device]
  443. host%> wget https://raw.githubusercontent.com/intel/pm-graph/master/tools/android.sh
  444. host%> adb connect 192.168.1.6
  445. host%> adb root
  446. # push the script to a writeable location
  447. host%> adb push android.sh /sdcard/
  448. [check whether the tool will run on your device]
  449. host%> adb shell
  450. dev%> cd /sdcard
  451. dev%> sh android.sh status
  452. host : asus_t100
  453. kernel : 3.14.0-i386-dirty
  454. modes : freeze mem
  455. rtcwake : supported
  456. ftrace : supported
  457. trace events {
  458. suspend_resume: found
  459. device_pm_callback_end: found
  460. device_pm_callback_start: found
  461. }
  462. # the above is what you see on a system that's properly patched
  463. [execute the suspend]
  464. # NOTE: The suspend will only work if the screen isn't timed out,
  465. # so you have to press some keys first to wake it up b4 suspend)
  466. dev%> sh android.sh suspend mem
  467. ------------------------------------
  468. Suspend/Resume timing test initiated
  469. ------------------------------------
  470. hostname : asus_t100
  471. kernel : 3.14.0-i386-dirty
  472. mode : mem
  473. ftrace out : /mnt/shell/emulated/0/ftrace.txt
  474. dmesg out : /mnt/shell/emulated/0/dmesg.txt
  475. log file : /mnt/shell/emulated/0/log.txt
  476. ------------------------------------
  477. INITIALIZING FTRACE........DONE
  478. STARTING FTRACE
  479. SUSPEND START @ 21:24:02 (rtcwake in 10 seconds)
  480. <adb connection will now terminate>
  481. [retrieve the data from the device]
  482. # I find that you have to actually kill the adb process and
  483. # reconnect sometimes in order for the connection to work post-suspend
  484. host%> adb connect 192.168.1.6
  485. # (required) get the ftrace data, this is the most important piece
  486. host%> adb pull /sdcard/ftrace.txt
  487. # (optional) get the dmesg data, this is for debugging
  488. host%> adb pull /sdcard/dmesg.txt
  489. # (optional) get the log, which just lists some test times for comparison
  490. host%> adb pull /sdcard/log.txt
  491. [create an output html file using sleepgraph.py]
  492. host%> sleepgraph.py -ftrace ftrace.txt
  493. You should now have an output.html with the android data, enjoy!