1 #include "debug-snapshot-log.h"
3 struct dbg_snapshot_log
*p
;
5 int main(int argc
, char *argv
[])
13 f
= fopen(argv
[1], "rb");
15 fputs("file read error!", stderr
);
18 fseek(f
, 0, SEEK_END
);
20 fseek(f
, 0, SEEK_SET
); //same as rewind(f);
22 string
= malloc(fsize
+ 1);
23 fread(string
, fsize
, 1, f
);
25 p
= (struct dbg_snapshot_log
*)string
;
28 for (i
= 0; i
< DSS_NR_CPUS
; i
++) {
29 for (j
= 0; j
< DSS_LOG_MAX_NUM
; j
++) {
30 if (p
->task
[i
][j
].time
== 0)
32 printf("log.append({'time':%.9f, 'type' : 'sched', 'cpu' : %d, 'comm' : '%s', 'pid' : %d})\n",
33 p
->task
[i
][j
].time
/1.0e9
,
35 p
->task
[i
][j
].task_comm
,
40 #ifdef CONFIG_DEBUG_SNAPSHOT_FREQ
41 for (i
= 0; i
< DSS_LOG_MAX_NUM
; i
++) {
42 if (p
->freq
[i
].time
== 0)
44 printf("log.append({'time':%.9f, 'type' : 'freq', 'cpu' : %d, 'cluster' : %d, 'freq' : %lu })\n",
45 p
->freq
[i
].time
/1.0e9
,
48 p
->freq
[i
].target_freq
);
52 for (i
= 0; i
< DSS_NR_CPUS
; i
++) {
53 for (j
= 0; j
< DSS_LOG_MAX_NUM
; j
++) {
54 if (p
->irq
[i
][j
].time
== 0)
56 printf("log.append({'time':%.9f, 'type' : 'irq', 'cpu' : %d, 'num' : %d,"
57 "'en' : %d, 'func' : '%p'})\n",
58 p
->irq
[i
][j
].time
/1.0e9
,
66 for (i
= 0; i
< DSS_NR_CPUS
; i
++) {
67 for (j
= 0; j
< DSS_LOG_MAX_NUM
; j
++) {
68 if (p
->cpuidle
[i
][j
].time
== 0)
70 printf("log.append({'time':%.9f, 'type' : 'cpuidle', 'cpu' : %d, 'state' : %d})\n",
71 p
->cpuidle
[i
][j
].time
/1.0e9
,
73 p
->cpuidle
[i
][j
].state
);
76 #ifdef CONFIG_DEBUG_SNAPSHOT_BINDER
77 for (i
= 0; i
< DSS_API_MAX_NUM
<< 2; i
++) {
78 if (p
->binder
[i
].time
== 0)
80 printf("log.append({'time':%.9f, 'type' : 'binder', 'cpu' : %d, 'trace_type' : %d, 'transaction_id' : %d,"
81 " 'from_pid' : %d, 'from_tid' : %d, 'to_pid' : %d, 'to_tid' : %d,"
82 " 'from_pid_comm' : '%s', 'from_tid_comm' : '%s',"
83 " 'to_pid_comm' : '%s', 'to_tid_comm' : '%s', 'to_node_id' : %d,"
84 " 'reply' : %d, 'flags' : 0x%x, 'code' : 0x%x,"
85 " 'return_error' : %d, 'return_error_param' : %d, 'return_error_line' : %d})\n",
86 p
->binder
[i
].time
/1.0e9
,
87 p
->binder
[i
].cpu
, p
->binder
[i
].base
.trace_type
, p
->binder
[i
].base
.transaction_id
,
88 p
->binder
[i
].base
.from_pid
, p
->binder
[i
].base
.from_tid
,
89 p
->binder
[i
].base
.to_pid
, p
->binder
[i
].base
.to_tid
,
90 p
->binder
[i
].base
.from_pid_comm
, p
->binder
[i
].base
.from_tid_comm
,
91 p
->binder
[i
].base
.to_pid_comm
, p
->binder
[i
].base
.to_tid_comm
,
92 p
->binder
[i
].transaction
.to_node_id
, p
->binder
[i
].transaction
.reply
,
93 p
->binder
[i
].transaction
.flags
, p
->binder
[i
].transaction
.code
,
94 p
->binder
[i
].error
.return_error
, p
->binder
[i
].error
.return_error_param
,
95 p
->binder
[i
].error
.return_error_line
);
98 #ifdef CONFIG_DEBUG_SNAPSHOT_ACPM
99 for (i
= 0; i
< DSS_LOG_MAX_NUM
; i
++) {
100 if (p
->acpm
[i
].time
== 0)
102 for (j
= 0; j
< 8; j
++) {
103 if (!((p
->acpm
[i
].log
[j
] >= 'a' && p
->acpm
[i
].log
[j
] <= 'z') || p
->acpm
[i
].log
[j
] == '_'))
104 p
->acpm
[i
].log
[j
] = 0;
106 printf("log.append({'time':%.9f, 'acpm_time':%.9f, 'type' : 'acpmlog', 'log' : '%s', 'value' : %d })\n",
107 p
->acpm
[i
].time
/1.0e9
,
108 p
->acpm
[i
].acpm_time
/1.0e9
,