• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright 2016 The Android Open Source Project
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *      http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 #include <dumpstate.h>
18 #include <cutils/properties.h>
19 #include <stdlib.h>
20 
dumpstate_board()21 void dumpstate_board()
22 {
23     char prop_str[PROPERTY_VALUE_MAX];
24     int len;
25     char *end_ptr;
26     unsigned long ret_val = 0;
27 
28     dump_file("CPU present", "/sys/devices/system/cpu/present");
29     dump_file("CPU online", "/sys/devices/system/cpu/online");
30     dump_file("RPM Stats", "/d/rpm_stats");
31     dump_file("Power Management Stats", "/d/rpm_master_stats");
32     dump_file("SMD Log", "/d/ipc_logging/smd/log");
33     run_command("ION HEAPS", 5, SU_PATH, "root", "/system/bin/sh", "-c", "for d in $(ls -d /d/ion/*); do for f in $(ls $d); do echo --- $d/$f; cat $d/$f; done; done", NULL);
34     dump_file("dmabuf info", "/d/dma_buf/bufinfo");
35     run_command("Temperatures", 5, SU_PATH, "root", "/system/bin/sh", "-c", "for f in `ls /sys/class/thermal` ; do type=`cat /sys/class/thermal/$f/type` ; temp=`cat /sys/class/thermal/$f/temp` ; echo \"$type: $temp\" ; done", NULL);
36     dump_file("cpu0-1 time-in-state", "/sys/devices/system/cpu/cpu0/cpufreq/stats/time_in_state");
37     run_command("cpu0-1 cpuidle", 5, SU_PATH, "root", "/system/bin/sh", "-c", "for d in $(ls -d /sys/devices/system/cpu/cpu0/cpuidle/state*); do echo \"$d: `cat $d/name` `cat $d/desc` `cat $d/time` `cat $d/usage`\"; done", NULL);
38     dump_file("cpu2-3 time-in-state", "/sys/devices/system/cpu/cpu2/cpufreq/stats/time_in_state");
39     run_command("cpu2-3 cpuidle", 5, SU_PATH, "root", "/system/bin/sh", "-c", "for d in $(ls -d /sys/devices/system/cpu/cpu2/cpuidle/state*); do echo \"$d: `cat $d/name` `cat $d/desc` `cat $d/time` `cat $d/usage`\"; done", NULL);
40     dump_file("MDP xlogs", "/d/mdp/xlog/dump");
41 
42     /* Check if smlog_dump tool exist */
43     if (!access("/system/bin/smlog_dump", F_OK)) {
44         property_get("persist.radio.smlog_switch" ,prop_str,"");
45         len = strlen(prop_str);
46         if (len > 0) {
47             ret_val = strtoul( prop_str, &end_ptr, 0 );
48         }
49 
50         /* Only SMLOG is enable, and SMLOG DUMP would be excuted */
51         if (ret_val == 1) {
52             run_command("SMLOG DUMP", 30, SU_PATH, "root", "smlog_dump", "-d", NULL);
53         }
54     }
55 
56     /* Check if qsee_logger tool exists */
57     if (!access("/system/bin/qsee_logger", F_OK)) {
58         run_command("FP LOGS", 10, "qsee_logger", "-d", NULL);
59     }
60 };
61