pvrlogdump 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729
  1. ################################################################################
  2. # @Copyright Copyright (c) Imagination Technologies Ltd.
  3. # All Rights Reserved
  4. # @License MIT
  5. #
  6. # The contents of this file are subject to the MIT license as set out below.
  7. #
  8. # Permission is hereby granted, free of charge, to any person obtaining a copy
  9. # of this software and associated documentation files (the "Software"), to deal
  10. # in the Software without restriction, including without limitation the rights
  11. # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  12. # copies of the Software, and to permit persons to whom the Software is
  13. # furnished to do so, subject to the following conditions:
  14. #
  15. # The above copyright notice and this permission notice shall be included in
  16. # all copies or substantial portions of the Software.
  17. #
  18. # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  19. # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  20. # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
  21. # THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  22. # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  23. # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  24. # THE SOFTWARE.
  25. ################################################################################
  26. ARGC=$#
  27. ARGV=$1
  28. # snapshot timestamp used to determine how much time passed since last
  29. # call to snapshot
  30. SSTS=0
  31. usage() {
  32. echo ""
  33. echo "Usage: $0 [OPTIONS | APP_NAME]"
  34. echo "Gathers diagnostic information for IMG."
  35. echo "If APP_NAME is specified also gather diagnostics on that specific app."
  36. echo "Note that APP_NAME should contain full path to the app binary."
  37. echo ""
  38. echo " -h, --help prints this message"
  39. echo ""
  40. }
  41. log_timestamp() {
  42. local ts="$(cat /proc/uptime)"
  43. echo ""
  44. if [ -z "$1" ]; then
  45. echo "[TS: ${ts% *}]"
  46. else
  47. echo "[TS ($1): ${ts% *}]"
  48. fi
  49. echo ""
  50. }
  51. init() {
  52. # detect os
  53. if [ -x "/system/bin/logcat" ]; then
  54. OS="Android"
  55. elif [ -d "/var/log/ui" ]; then
  56. OS="Chrome"
  57. else
  58. OS="Linux"
  59. fi
  60. if [ $OS = 'Android' ]; then
  61. USERID=$USER_ID
  62. # grep's '-o' option is not POSIX compliant but since this case is
  63. # Android specific and it's supported we don't care
  64. VER_MAJOR=$(getprop ro.build.version.release | grep -oE "^[[:digit:]]+")
  65. # we assume major.minor version format which is used since Android 5
  66. # major part is always correct
  67. VER_MINOR=$(getprop ro.build.version.release | grep -oE "[[:digit:]]+$")
  68. else
  69. USERID=`id -u`
  70. fi
  71. if [ "$USERID" != "0" ]; then
  72. echo "This script needs to be executed with root privileges."
  73. exit 1
  74. fi
  75. if [ "$ARGC" -gt "1" ]; then
  76. echo "Error: Too many arguments."
  77. usage
  78. exit 1
  79. fi
  80. if [ "$ARGV" = "--help" ] || [ "$ARGV" = "-h" ]; then
  81. usage
  82. exit 0
  83. fi
  84. # output file
  85. if [ -d /tmp ]; then
  86. OUT=/tmp/`date +pvrlogdump_%y%m%d%H%M.txt`
  87. else
  88. OUT=`date +pvrlogdump_%y%m%d%H%M.txt`
  89. fi
  90. # some useful variables
  91. DEBUGFS_PATH=/sys/kernel/debug
  92. if [ -d $DEBUGFS_PATH/pvr ]; then
  93. PVR_DEBUGFS_PATH=$DEBUGFS_PATH/pvr
  94. elif [ -d /proc/pvr ]; then
  95. PVR_DEBUGFS_PATH=/proc/pvr
  96. fi
  97. if [ -d $DEBUG_PATH ]; then
  98. FTRACE_PATH=$DEBUGFS_PATH/tracing
  99. elif [ -d /sys/kernel/tracing ]; then
  100. FTRACE_PATH=/sys/kernel/tracing
  101. fi
  102. LOCKDEP_PATH=/proc/lockdep
  103. PVRINI_PATH=/etc/powervr.ini
  104. INSTKMLOG_PATH=/etc/powervr_ddk_install_km.log
  105. INSTUMLOG_PATH=/etc/powervr_ddk_install_um.log
  106. if [ "$ARGC" -eq "1" ]; then
  107. APPNAME=$ARGV
  108. fi
  109. }
  110. perform_check() {
  111. echo -n "Checking driver state ............... "
  112. if [ -d $PVR_DEBUGFS_PATH ]; then
  113. LOADED=true
  114. DRIVER_STATE="initialised"
  115. else
  116. if [ -d /sys/module/pvrsrvkm ]; then
  117. LOADED=true
  118. DRIVER_STATE="loaded"
  119. else
  120. LOADED=false
  121. DRIVER_STATE="not loaded"
  122. fi
  123. fi
  124. echo "$DRIVER_STATE"
  125. if [ "$LOADED" = "false" ]; then
  126. echo " Driver is not loaded. Not all crucial information can be"
  127. echo " gathered in that state. Please consider running the driver."
  128. fi
  129. echo -n "Checking for debugfs ................ "
  130. if [ -d $PVR_DEBUGFS_PATH ]; then
  131. echo "found"
  132. else
  133. echo "not found"
  134. fi
  135. echo -n "Checking for lockdep ................ "
  136. if [ -f $LOCKDEP_PATH ]; then
  137. echo "found"
  138. else
  139. echo "not found"
  140. fi
  141. echo -n "Checking for ftrace ................. "
  142. if [ -d $FTRACE_PATH ]; then
  143. echo "found"
  144. else
  145. echo "not found"
  146. fi
  147. echo -n "Checking for firmware log groups .... "
  148. local FW_LOG_GROUPS_EN=false
  149. if [ -f $PVR_DEBUGFS_PATH/apphint/0/EnableLogGroup ] && \
  150. [ $(cat $PVR_DEBUGFS_PATH/apphint/0/EnableLogGroup) != "none" ]; then
  151. FW_LOG_GROUPS_EN=true
  152. else
  153. if [ -f $PVRINI_PATH ]; then
  154. if [ -n "$(grep -E ^EnableLogGroup.+[#\;]* $PVRINI_PATH)" ]; then
  155. FW_LOG_GROUPS_EN=true
  156. fi
  157. fi
  158. fi
  159. if [ "$FW_LOG_GROUPS_EN" = "true" ]; then
  160. echo "found"
  161. else
  162. echo "not found"
  163. echo " There are no AppHints enabled in $PVRINI_PATH or in debugfs"
  164. echo " for any of the firmware log groups. Unless 'pvrdebug' tool"
  165. echo " was used for that purpose there will be no information in"
  166. echo " firmware log."
  167. echo " Please consider enabling some of the firmware log groups"
  168. echo " before the problem occurs."
  169. fi
  170. }
  171. dump_env_info() {
  172. echo ""
  173. echo "===== Dumping environment info ======================================"
  174. echo ""
  175. log_timestamp
  176. echo "Date:" `date`
  177. echo "/proc/version:" `cat /proc/version`
  178. echo ""
  179. echo "Driver state: $DRIVER_STATE"
  180. echo ""
  181. echo "env:"
  182. export -p
  183. echo ""
  184. echo "lsmod:"
  185. lsmod
  186. echo ""
  187. echo "/cpu/info"
  188. cat /proc/cpuinfo
  189. echo ""
  190. echo "/proc/meminfo"
  191. cat /proc/meminfo
  192. if [ $OS = "Linux" ]; then
  193. echo ""
  194. echo "lshw"
  195. lshw -quiet
  196. fi
  197. }
  198. dump_installation_log() {
  199. echo ""
  200. echo "===== Dumping powervr_ddk_install_km.log ============================"
  201. echo ""
  202. log_timestamp
  203. if [ -f $INSTKMLOG_PATH ]; then
  204. cat $INSTKMLOG_PATH
  205. else
  206. echo "Not found"
  207. fi
  208. echo ""
  209. echo "===== Dumping powervr_ddk_install_um.log ============================"
  210. echo ""
  211. if [ -f $INSTUMLOG_PATH ]; then
  212. head $INSTUMLOG_PATH
  213. else
  214. echo "Not found"
  215. fi
  216. }
  217. dump_apphints() {
  218. echo ""
  219. echo "===== Dumping powervr.ini ==========================================="
  220. echo ""
  221. log_timestamp
  222. if [ -f $PVRINI_PATH ]; then
  223. cat $PVRINI_PATH
  224. else
  225. echo "Not found"
  226. fi
  227. }
  228. dump_fw_snapshot() {
  229. echo ""
  230. echo "===== Dumping fw snapshot ==========================================="
  231. echo ""
  232. log_timestamp
  233. if [ $SSTS -eq 0 ]; then
  234. # save current time for the next call
  235. SSTS=$(date +%s)
  236. else
  237. local DIFF=$(($(date +%s) - $SSTS))
  238. if [ $DIFF -lt 3 ]; then
  239. # wait before making 2nd snapshot
  240. sleep 2;
  241. fi
  242. fi
  243. # handle multidevice case where there can be per device (gpuXX)
  244. # subdirectories
  245. local DEVICES="$(ls -d $PVR_DEBUGFS_PATH/gpu* 2>/dev/null)"
  246. if [ -z "$DEVICES" ]; then
  247. local DEVICES="$PVR_DEBUGFS_PATH"
  248. fi
  249. for PVR_DEBUGFS_DEVICE_PATH in $DEVICES; do
  250. local DEVICE_ID=$(basename $PVR_DEBUGFS_DEVICE_PATH)
  251. local FW_TRACE=$(readlink -f $PVR_DEBUGFS_DEVICE_PATH)/firmware_trace
  252. local DEBUG_DUMP=$(readlink -f $PVR_DEBUGFS_DEVICE_PATH)/debug_dump
  253. # in case the script is run on an older DDK with no device subdirs
  254. if [ "${DEVICE_ID}" = "pvr" ]; then
  255. local DEVICE_ID="gpu00"
  256. fi
  257. for IDX in 1 2; do
  258. # if there is a firmware log file dump it for our convenience
  259. if [ -f $FW_TRACE ]; then
  260. echo ""
  261. echo "==== firmware_trace ($DEVICE_ID, $IDX) ===="
  262. echo ""
  263. cat $FW_TRACE
  264. fi
  265. # if there is debug_dump file then dump it but if for some reason
  266. # it's absent use dmesg to obtain it
  267. if [ -f $DEBUG_DUMP ]; then
  268. echo ""
  269. echo "==== debug_dump ($DEVICE_ID, $IDX) ===="
  270. echo ""
  271. cat $DEBUG_DUMP
  272. else
  273. echo ""
  274. echo "==== dmesg ($DEVICE_ID, $IDX) ===="
  275. echo ""
  276. if [ -c /dev/kmsg ]; then
  277. echo "" >/dev/kmsg
  278. echo "==== debug_dump ($DEVICE_ID, $IDX) ====" >/dev/kmsg
  279. echo "" >/dev/kmsg
  280. fi
  281. if command -v pvrdebug >/dev/null 2>&1; then
  282. if ! pvrdebug -dd >/dev/null 2>&1; then
  283. if [ -c /dev/kmsg ]; then
  284. echo "pvrdebug failed" >/dev/kmsg
  285. fi
  286. fi
  287. fi
  288. dmesg
  289. fi
  290. # skip sleep on last iteration
  291. if [ $IDX -ne 2 ]; then
  292. # Android, ChromeOS and most Linux distributions accept time as
  293. # a floating point number so wait for 10ms
  294. # but e.g. busybox supports only integers so wait for 1s
  295. if ! sleep 0.01 >/dev/null 2>&1; then sleep 1; fi
  296. fi
  297. done
  298. done
  299. }
  300. dump_dmesg() {
  301. echo ""
  302. echo "===== Dumping dmesg ================================================="
  303. echo ""
  304. log_timestamp
  305. dmesg
  306. # even if debugfs exists dump firmware log to dmesg because
  307. # there may be some additional information that are not present in debugfs
  308. if command pvrdebug >/dev/null 2>&1; then
  309. if [ "$LOADED" = "true" ]; then
  310. echo ""
  311. echo "===== Running pvrdebug -dd then dumping dmesg ======================="
  312. echo ""
  313. pvrdebug -dd >/dev/null 2>&1
  314. dmesg
  315. fi
  316. fi
  317. }
  318. dump_debugfs() {
  319. local BLACKLIST="
  320. $PVR_DEBUGFS_PATH/rgxregs
  321. "
  322. echo ""
  323. echo "===== Dumping files from pvr debugfs ================================"
  324. echo ""
  325. log_timestamp
  326. if [ -d $PVR_DEBUGFS_PATH ]; then
  327. # android below version 6 (Marshmallow) doesn't have 'find' command
  328. if [ $OS = "Android" ] && [ $VER_MAJOR -lt 6 ]; then
  329. ls -FR $PVR_DEBUGFS_PATH | while read FILE; do
  330. if echo $FILE | grep / >/dev/null 2>&1; then
  331. # save last found full directory path
  332. DIR=$FILE
  333. continue
  334. fi
  335. if echo $FILE | grep -E "^d .+" >/dev/null 2>&1; then
  336. # ignore as it is a subdirectory
  337. continue
  338. fi
  339. if echo $FILE | grep -E "^- .+" >/dev/null 2>&1; then
  340. echo -e "\n==== ${DIR%:}/${FILE#- } ====\n"
  341. cat ${DIR%:}/${FILE#- }
  342. fi
  343. done
  344. else
  345. local FILES="`find $PVR_DEBUGFS_PATH -type f`"
  346. for FILE in $FILES; do
  347. local IGNORE=false
  348. for ELEMENT in $BLACKLIST; do
  349. if [ $ELEMENT = $FILE ]; then
  350. IGNORE=true
  351. break
  352. fi
  353. done
  354. if [ "$IGNORE" = "true" ]; then
  355. continue
  356. fi
  357. echo ""
  358. echo "==== $FILE ===="
  359. echo ""
  360. cat $FILE
  361. done
  362. fi
  363. else
  364. echo "Not found"
  365. fi
  366. }
  367. # check if SurfaceFlinger is running
  368. # this function is Android-specific
  369. android_check_surfaceflinger_running() {
  370. # 'dumpsys -l' will return a list of all services running.
  371. # use grep to see if SurfaceFlinger is running.
  372. dumpsys -l | grep SurfaceFlinger >/dev/null 2>&1
  373. # return the exit code from grep.
  374. # if SurfaceFlinger was found in the services list then grep will have
  375. # exited with exit code 0 (true)
  376. return $?
  377. }
  378. dump_android() {
  379. echo ""
  380. echo "===== Dumping android logs =========================================="
  381. echo ""
  382. log_timestamp
  383. if [ -x /system/bin/logcat ]; then
  384. echo ""
  385. echo "==== android/logcat ===="
  386. echo ""
  387. logcat -d
  388. fi
  389. if [ -x /system/bin/dumpsys ]; then
  390. echo ""
  391. echo "==== android/dumpsys ===="
  392. echo ""
  393. android_check_surfaceflinger_running
  394. if [ $? = 0 ]; then
  395. dumpsys
  396. else
  397. echo "Android services not running. dumpsys skipped."
  398. fi
  399. fi
  400. # NOTE: It might be worth to call also dumpstate (which runs procrank) here
  401. # but procrank causes some of the targets to crash. It's left out for now.
  402. }
  403. dump_chrome() {
  404. echo ""
  405. echo "===== Dumping ChromeOS UI logs ======================================"
  406. echo ""
  407. log_timestamp
  408. local UILOGS="/var/log/chrome/chrome /home/chronos/user/log/chrome \
  409. /var/log/ui/ui.LATEST"
  410. for FILE in $UILOGS; do
  411. echo ""
  412. echo "==== $FILE ===="
  413. echo ""
  414. if [ -f $FILE ]; then
  415. cat $FILE
  416. else
  417. echo "Not found"
  418. fi
  419. done
  420. }
  421. dump_native_sync_info() {
  422. echo ""
  423. echo "==== Dumping native syncs info ======================================"
  424. echo ""
  425. log_timestamp
  426. if [ -f $DEBUGFS_PATH/sync ]; then
  427. echo ""
  428. echo "==== $DEBUGFS_PATH/sync ===="
  429. echo ""
  430. cat $DEBUGFS_PATH/sync
  431. elif [ -f $DEBUGFS_PATH/sync/info ]; then
  432. echo ""
  433. echo "==== $DEBUGFS_PATH/sync/info ===="
  434. echo ""
  435. cat $DEBUGFS_PATH/sync/info
  436. else
  437. echo "Not found"
  438. fi
  439. }
  440. dump_lockdep() {
  441. echo ""
  442. echo "===== Dumping lockdep related files ================================="
  443. echo ""
  444. log_timestamp
  445. if [ -f $LOCKDEP_PATH ]; then
  446. local FILES="/proc/lockdep_stats $LOCKDEP_PATH /proc/lockdep_chains"
  447. for FILE in $FILES; do
  448. echo ""
  449. echo "==== $FILE ===="
  450. echo ""
  451. if [ -f $FILE ]; then
  452. cat $FILE
  453. else
  454. echo "Not found"
  455. fi
  456. done
  457. else
  458. echo "Not found"
  459. fi
  460. }
  461. dump_ftrace() {
  462. echo ""
  463. echo "===== Dumping ftrace files =========================================="
  464. echo ""
  465. log_timestamp
  466. if [ -d $FTRACE_PATH ]; then
  467. local FILES="$FTRACE_PATH/trace $FTRACE_PATH/trace_clock \
  468. $FTRACE_PATH/tracing_on $FTRACE_PATH/buffer_size_kb \
  469. $FTRACE_PATH/buffer_total_size_kb"
  470. for FILE in $FILES; do
  471. echo ""
  472. echo "==== $FILE ===="
  473. echo ""
  474. if [ -f $FILE ]; then
  475. cat $FILE
  476. else
  477. echo "Not found"
  478. fi
  479. done
  480. if [ -d $FTRACE_PATH/per_cpu ]; then
  481. local PERCPU_FILES="buffer_size_kb stats"
  482. for CPU in `ls $FTRACE_PATH/per_cpu`; do
  483. for FILE in $PERCPU_FILES; do
  484. echo ""
  485. echo "==== $FTRACE_PATH/per_cpu/$CPU/$FILE ===="
  486. echo ""
  487. if [ -f $FTRACE_PATH/per_cpu/$CPU/$FILE ]; then
  488. cat $FTRACE_PATH/per_cpu/$CPU/$FILE
  489. else
  490. echo "Not found"
  491. fi
  492. done
  493. done
  494. fi
  495. else
  496. echo "Not found"
  497. fi
  498. }
  499. dump_pvrhtb() {
  500. echo ""
  501. echo "===== Dumping HTB trace file ========================================"
  502. echo ""
  503. log_timestamp
  504. if ! command pvrhtbd -h >/dev/null 2>&1; then
  505. return
  506. fi
  507. TMP_HTB_FILE="pvrhtbd_output"
  508. if [ "$OS" = "Android" ]; then
  509. TMP_HTB_FILE="/data/local/tmp/$TMP_HTB_FILE"
  510. else
  511. TMP_HTB_FILE="/tmp/$TMP_HTB_FILE"
  512. fi
  513. if [ "$LOADED" = "true" ]; then
  514. pvrhtbd --grab > $TMP_HTB_FILE 2>&1
  515. HTBD_OUT_FILE=`grep "Host Trace Data written to" $TMP_HTB_FILE`
  516. # if we fail to parse the output and find the file name then
  517. # add this information to the output, in addition to
  518. # the output from pvrhtbd so we can see any errors it printed
  519. if [ -z "$HTBD_OUT_FILE" ]; then
  520. echo "Failed to get pvrhtbd output file name. Command output"
  521. echo "follows."
  522. cat $TMP_HTB_FILE
  523. rm $TMP_HTB_FILE
  524. return
  525. fi
  526. HTBD_OUT_FILE=${HTBD_OUT_FILE#Host Trace Data written to: }
  527. rm $TMP_HTB_FILE
  528. if [ -f $HTBD_OUT_FILE ]; then
  529. cat $HTBD_OUT_FILE
  530. fi
  531. fi
  532. }
  533. dump_app_info() {
  534. echo ""
  535. echo "===== Dumping app info =============================================="
  536. echo ""
  537. log_timestamp
  538. if [ -f "$APPNAME" ]; then
  539. echo "Analysing $APPNAME"
  540. if [ -f `dirname $APPNAME`/powervr.ini ]; then
  541. echo `dirname $APPNAME`/powervr.ini
  542. cat `dirname $APPNAME`/powervr.ini
  543. fi
  544. echo ""
  545. echo "Checking nature of $APPNAME:"
  546. file $APPNAME
  547. echo
  548. echo "Checking linkage of $APPNAME:"
  549. ldd $APPNAME
  550. else
  551. if [ -n "$APPNAME" ]; then
  552. echo "Not app with name '$APPNAME' exists."
  553. echo ""
  554. fi
  555. if [ -f /usr/local/bin/gltest1 ]; then
  556. echo "Checking linkage of gltest1:"
  557. ldd /usr/local/bin/gltest1
  558. fi
  559. if [ -f /usr/local/bin/gles1test1 ]; then
  560. echo ""
  561. echo "Checking linkage of gles1test1:"
  562. ldd /usr/local/bin/gles1test1
  563. fi
  564. if [ -f /usr/local/bin/xgltest1 ]; then
  565. echo ""
  566. echo "Checking linkage of xgltest1:"
  567. ldd /usr/local/bin/xgltest1
  568. fi
  569. if [ -f /usr/local/bin/xgles1test1 ]; then
  570. echo ""
  571. echo "Checking linkage of xgles1test1:"
  572. ldd /usr/local/bin/xgles1test1
  573. fi
  574. fi
  575. }
  576. dump_all() {
  577. echo ""
  578. echo -n "Dumping data ........................ "
  579. log_timestamp "START" >> $OUT
  580. dump_env_info >> $OUT 2>&1
  581. dump_installation_log >> $OUT
  582. dump_apphints >> $OUT
  583. dump_fw_snapshot >> $OUT
  584. dump_dmesg >> $OUT
  585. dump_pvrhtb >> $OUT
  586. dump_debugfs >> $OUT 2>&1
  587. if [ $OS = "Android" ]; then
  588. dump_android >> $OUT 2>&1
  589. fi
  590. if [ $OS = "Chrome" ]; then
  591. dump_chrome >> $OUT 2>&1
  592. fi
  593. dump_native_sync_info >> $OUT 2>&1
  594. dump_lockdep >> $OUT
  595. dump_ftrace >> $OUT
  596. dump_app_info >> $OUT
  597. dump_fw_snapshot >> $OUT
  598. log_timestamp "END" >> $OUT
  599. echo "done"
  600. }
  601. archive() {
  602. if [ $OS = "Android" ]; then
  603. if [ ! -x /system/bin/gzip ]; then
  604. return
  605. fi
  606. else
  607. if ! command -v gzip >/dev/null 2>&1; then
  608. return
  609. fi
  610. fi
  611. echo -n "Archiving data ...................... "
  612. gzip -f $OUT
  613. echo "done"
  614. echo ""
  615. echo "File $OUT.gz was created."
  616. }
  617. main() {
  618. init
  619. touch $OUT
  620. perform_check
  621. dump_all
  622. archive
  623. }
  624. # main function
  625. main