From: Youngwan Kim Date: Wed, 11 Jul 2018 02:14:56 +0000 (+0900) Subject: [COMMON] lib: libdss: change dss-reader to libdss X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=8c02497ea07ed452d3b2ac5eda9dd31e92973326;p=GitHub%2FLineageOS%2Fandroid_kernel_motorola_exynos9610.git [COMMON] lib: libdss: change dss-reader to libdss It's to fix build error in environment not installed qemu-aarch64. Change-Id: I6156bb191bfbfd80f29b46c713b13379a9e9b050 Signed-off-by: Youngwan Kim --- diff --git a/Makefile b/Makefile index a8ef69a479b5..73759d9c8377 100644 --- a/Makefile +++ b/Makefile @@ -14,7 +14,7 @@ NAME = Petit Gorille # That's our default target when none is given on the command line PHONY := _all _all: - @lib/dss-reader-build.sh + @lib/libdss-build.sh # o Do not use make's built-in rules and variables # (this increases performance and avoids hard-to-debug behaviour); diff --git a/lib/dss-reader-build.sh b/lib/dss-reader-build.sh deleted file mode 100755 index a694f028e27a..000000000000 --- a/lib/dss-reader-build.sh +++ /dev/null @@ -1,29 +0,0 @@ -clang \ ---target=aarch64-linux-gnu \ --I/usr/aarch64-linux-gnu/include \ --Iinclude \ --mlittle-endian \ --Qunused-arguments \ --fno-strict-aliasing \ --fno-common \ --fshort-wchar \ --std=gnu89 \ --DDSS_ANALYZER \ --fno-PIE \ --mno-implicit-float \ --DCONFIG_BROKEN_GAS_INST=1 \ --fno-asynchronous-unwind-tables \ --fno-pic \ --Oz \ --Wframe-larger-than=4096 \ --fno-stack-protector \ --mno-global-merge \ --no-integrated-as \ --fno-omit-frame-pointer \ --fno-optimize-sibling-calls \ --g \ --static \ --fno-strict-overflow \ --fno-merge-all-constants \ --fno-stack-check \ --g lib/dss-reader.c -o dss-reader diff --git a/lib/dss-reader.c b/lib/dss-reader.c deleted file mode 100644 index 9aa44339ece8..000000000000 --- a/lib/dss-reader.c +++ /dev/null @@ -1,109 +0,0 @@ -#include "debug-snapshot-log.h" - -struct dbg_snapshot_log *p; - -int main(int argc, char *argv[]) -{ - FILE *f; - int ch; - long fsize; - char *string; - int i, j; - - f = fopen(argv[1], "rb"); - if (f == NULL) { - fputs("file read error!", stderr); - exit(1); - } - fseek(f, 0, SEEK_END); - fsize = ftell(f); - fseek(f, 0, SEEK_SET); //same as rewind(f); - - string = malloc(fsize + 1); - fread(string, fsize, 1, f); - fclose(f); - p = (struct dbg_snapshot_log *)string; - - printf("log = {}\n"); - for (i = 0; i < DSS_NR_CPUS; i++) { - for (j = 0; j < DSS_LOG_MAX_NUM; j++) { - printf("log[%.9f] = { 'type' : 'sched', 'cpu' : %d, 'comm' : '%s', 'pid' : %d}\n", - p->task[i][j].time/1.0e9, - i, - p->task[i][j].task_comm, - p->task[i][j].pid); - if (p->task[i][j].time == 0) - break; - } - } - -#ifdef CONFIG_DEBUG_SNAPSHOT_FREQ - for (i = 0; i < DSS_LOG_MAX_NUM; i++) { - printf("log[%.9f] = { 'type' : 'freq', 'cpu' : %d, 'cluster' : %d, 'freq' : %lu }\n", - p->freq[i].time/1.0e9, - p->freq[i].cpu, - p->freq[i].type, - p->freq[i].target_freq); - if (p->freq[i].time == 0) - break; - } -#endif - - for (i = 0; i < DSS_NR_CPUS; i++) { - for (j = 0; j < DSS_LOG_MAX_NUM; j++) { - printf("log[%.9f] = { 'type' : 'irq', 'cpu' : %d, 'num' : %d," - "'en' : %d, 'func' : '%p'}\n", - p->irq[i][j].time/1.0e9, - i, - p->irq[i][j].irq, - p->irq[i][j].en, - p->irq[i][j].fn); - if (p->irq[i][j].time == 0) - break; - } - } - - for (i = 0; i < DSS_NR_CPUS; i++) { - for (j = 0; j < DSS_LOG_MAX_NUM; j++) { - printf("log[%.9f] = { 'type' : 'cpuidle', 'cpu' : %d, 'state' : %d}\n", - p->cpuidle[i][j].time/1.0e9, - i, - p->cpuidle[i][j].state); - if (p->cpuidle[i][j].time == 0) - break; - } - } -#ifdef CONFIG_DEBUG_SNAPSHOT_BINDER - for (i = 0; i < DSS_API_MAX_NUM << 2; i++) - { - printf("log[%.9f] = { 'type' : 'binder', 'cpu' : %d, 'trace_type' : %d, 'transaction_id' : %d, 'from_pid' : %d,"\ - " 'from_tid' : %d, 'to_pid' : %d, 'to_tid' : %d, 'from_pid_comm' : '%s', 'from_tid_comm' : '%s',"\ - " 'to_pid_comm' : '%s', 'to_tid_comm' : '%s', 'to_node_id' : %d, 'reply' : %d, 'flags' : 0x%x, 'code' : 0x%x,"\ - " 'return_error' : %d, 'return_error_param' : %d, 'return_error_line' : %d}\n", - p->binder[i].time/1.0e9, - p->binder[i].cpu, - p->binder[i].base.trace_type, p->binder[i].base.transaction_id, - p->binder[i].base.from_pid, p->binder[i].base.from_tid, p->binder[i].base.to_pid, p->binder[i].base.to_tid, - p->binder[i].base.from_pid_comm, p->binder[i].base.from_tid_comm, - p->binder[i].base.to_pid_comm, p->binder[i].base.to_tid_comm, - p->binder[i].transaction.to_node_id, p->binder[i].transaction.reply, - p->binder[i].transaction.flags, p->binder[i].transaction.code, - p->binder[i].error.return_error, p->binder[i].error.return_error_param, p->binder[i].error.return_error_line); - if (p->binder[i].time == 0) - break; - } -#endif -#ifdef CONFIG_DEBUG_SNAPSHOT_ACPM - for (i = 0; i < DSS_LOG_MAX_NUM; i++) - { - printf("log[%.9f] = { 'type' : 'acpmlog', 'log' : '%s', 'value' : %d }\n", - p->acpm[i].acpm_time/1.0e9, - p->acpm[i].log, - p->acpm[i].data); - if (p->acpm[i].time == 0) - break; - } -#endif - return 0; -} - diff --git a/lib/libdss-build.sh b/lib/libdss-build.sh new file mode 100755 index 000000000000..d61c4ec63e13 --- /dev/null +++ b/lib/libdss-build.sh @@ -0,0 +1,30 @@ +clang \ + --target=aarch64-linux-gnu \ + -I/usr/aarch64-linux-gnu/include \ + -Iinclude \ + -mlittle-endian \ + -Qunused-arguments \ + -fno-strict-aliasing \ + -fno-common \ + -fshort-wchar \ + -std=gnu89 \ + -DDSS_ANALYZER \ + -fno-PIE \ + -mno-implicit-float \ + -DCONFIG_BROKEN_GAS_INST=1 \ + -fno-asynchronous-unwind-tables \ + -fno-pic \ + -Oz \ + -Wframe-larger-than=4096 \ + -fno-stack-protector \ + -mno-global-merge \ + -fno-omit-frame-pointer \ + -fno-optimize-sibling-calls \ + -c \ + -static \ + -fno-strict-overflow \ + -fno-merge-all-constants \ + -fno-stack-check \ + -g lib/libdss.c -o lib/libdss.o + +aarch64-linux-android-ar -rc libdss.a lib/libdss.o diff --git a/lib/libdss.c b/lib/libdss.c new file mode 100644 index 000000000000..ef7a0a337282 --- /dev/null +++ b/lib/libdss.c @@ -0,0 +1,110 @@ +#include "debug-snapshot-log.h" + +struct dbg_snapshot_log *p; + +int main(int argc, char *argv[]) +{ + FILE *f; + int ch; + long fsize; + char *string; + int i, j; + + f = fopen(argv[1], "rb"); + if (f == NULL) { + fputs("file read error!", stderr); + exit(1); + } + fseek(f, 0, SEEK_END); + fsize = ftell(f); + fseek(f, 0, SEEK_SET); //same as rewind(f); + + string = malloc(fsize + 1); + fread(string, fsize, 1, f); + fclose(f); + p = (struct dbg_snapshot_log *)string; + + printf("log = {}\n"); + for (i = 0; i < DSS_NR_CPUS; i++) { + for (j = 0; j < DSS_LOG_MAX_NUM; j++) { + printf("log[%.9f] = { 'type' : 'sched', 'cpu' : %d, 'comm' : '%s', 'pid' : %d}\n", + p->task[i][j].time/1.0e9, + i, + p->task[i][j].task_comm, + p->task[i][j].pid); + if (p->task[i][j].time == 0) + break; + } + } + +#ifdef CONFIG_DEBUG_SNAPSHOT_FREQ + for (i = 0; i < DSS_LOG_MAX_NUM; i++) { + printf("log[%.9f] = { 'type' : 'freq', 'cpu' : %d, 'cluster' : %d, 'freq' : %lu }\n", + p->freq[i].time/1.0e9, + p->freq[i].cpu, + p->freq[i].type, + p->freq[i].target_freq); + if (p->freq[i].time == 0) + break; + } +#endif + + for (i = 0; i < DSS_NR_CPUS; i++) { + for (j = 0; j < DSS_LOG_MAX_NUM; j++) { + printf("log[%.9f] = { 'type' : 'irq', 'cpu' : %d, 'num' : %d," + "'en' : %d, 'func' : '%p'}\n", + p->irq[i][j].time/1.0e9, + i, + p->irq[i][j].irq, + p->irq[i][j].en, + p->irq[i][j].fn); + if (p->irq[i][j].time == 0) + break; + } + } + + for (i = 0; i < DSS_NR_CPUS; i++) { + for (j = 0; j < DSS_LOG_MAX_NUM; j++) { + printf("log[%.9f] = { 'type' : 'cpuidle', 'cpu' : %d, 'state' : %d}\n", + p->cpuidle[i][j].time/1.0e9, + i, + p->cpuidle[i][j].state); + if (p->cpuidle[i][j].time == 0) + break; + } + } +#ifdef CONFIG_DEBUG_SNAPSHOT_BINDER + for (i = 0; i < DSS_API_MAX_NUM << 2; i++) { + printf("log[%.9f] = { 'type' : 'binder', 'cpu' : %d, 'trace_type' : %d, 'transaction_id' : %d," + " 'from_pid' : %d, 'from_tid' : %d, 'to_pid' : %d, 'to_tid' : %d," + " 'from_pid_comm' : '%s', 'from_tid_comm' : '%s'," + " 'to_pid_comm' : '%s', 'to_tid_comm' : '%s', 'to_node_id' : %d," + " 'reply' : %d, 'flags' : 0x%x, 'code' : 0x%x," + " 'return_error' : %d, 'return_error_param' : %d, 'return_error_line' : %d}\n", + p->binder[i].time/1.0e9, + p->binder[i].cpu, p->binder[i].base.trace_type, p->binder[i].base.transaction_id, + p->binder[i].base.from_pid, p->binder[i].base.from_tid, + p->binder[i].base.to_pid, p->binder[i].base.to_tid, + p->binder[i].base.from_pid_comm, p->binder[i].base.from_tid_comm, + p->binder[i].base.to_pid_comm, p->binder[i].base.to_tid_comm, + p->binder[i].transaction.to_node_id, p->binder[i].transaction.reply, + p->binder[i].transaction.flags, p->binder[i].transaction.code, + p->binder[i].error.return_error, p->binder[i].error.return_error_param, + p->binder[i].error.return_error_line); + if (p->binder[i].time == 0) + break; + } +#endif +#ifdef CONFIG_DEBUG_SNAPSHOT_ACPM + for (i = 0; i < DSS_LOG_MAX_NUM; i++) { + printf("log[%.9f] = { 'type' : 'acpmlog', 'log' : '%s', 'value' : %d }\n", + p->acpm[i].acpm_time/1.0e9, + p->acpm[i].log, + p->acpm[i].data); + if (p->acpm[i].time == 0) + break; + } +#endif + return 0; +} +