From 3497d5910c57744d04f8d74e619bec347a2c141e Mon Sep 17 00:00:00 2001 From: xiongzhou4 Date: Tue, 11 Jul 2023 14:43:47 +0800 Subject: [PATCH] [refactor] Reuse calcsum, delay pre-reboot operations and fixs typos. --- GcovSummaryAddTool.cpp | 2 +- a-fot | 2 +- auto_kernel_pgo.sh | 17 ++++++++++------- 3 files changed, 12 insertions(+), 9 deletions(-) diff --git a/GcovSummaryAddTool.cpp b/GcovSummaryAddTool.cpp index 656f3d5..bbcc94b 100644 --- a/GcovSummaryAddTool.cpp +++ b/GcovSummaryAddTool.cpp @@ -171,6 +171,6 @@ int main(int argc, char** argv) return 1; } } - fprintf(stderr, "[.] File procesed: %d \n", (int) fileNames.size()); + fprintf(stderr, "[.] File processed: %d \n", (int) fileNames.size()); return 0; } diff --git a/a-fot b/a-fot index bc9e38f..151efd7 100755 --- a/a-fot +++ b/a-fot @@ -197,7 +197,7 @@ For kernel PGO mode: --work_path Script working directory (used to store the profile and the log) --run_script Script path for running application --gcc_path Compiler gcc path ---CONFIG_... Kernel building +--CONFIG_... Kernel building configuration --last_time Last time directory before rebooting (used to put log infos together) -s Silent mode (reboot automatically after kernel installation) -n Do not compile kernel automatically diff --git a/auto_kernel_pgo.sh b/auto_kernel_pgo.sh index d7814e8..9e90769 100644 --- a/auto_kernel_pgo.sh +++ b/auto_kernel_pgo.sh @@ -191,10 +191,10 @@ function first_reboot() { echo -e "[INFO] Please run this command to continue after rebooting:\n${next_cmd}" | tee -a ${log_file} fi else - echo ${next_cmd} >>/etc/rc.d/rc.local - chmod +x /etc/rc.d/rc.local echo "[WARNING] System will be rebooted in 10 seconds!!!" | tee -a ${log_file} sleep 10 + echo ${next_cmd} >>/etc/rc.d/rc.local + chmod +x /etc/rc.d/rc.local reboot fi exit 0 @@ -226,8 +226,11 @@ function process_profiles() { echo "[INFO] Start post-processing the profiles." | tee -a ${log_file} find ${temp_dir} -name '*.gcda' >list.txt - /usr/bin/g++ ${afot_path}/GcovSummaryAddTool.cpp -o calcsum - ./calcsum list.txt + calcsum=${afot_path}/calcsum + if [[ ! -f ${calcsum} ]]; then + /usr/bin/g++ ${afot_path}/GcovSummaryAddTool.cpp -o ${calcsum} + fi + ${calcsum} list.txt rm -f list.txt profile_dir=${time_dir}/gcovdata @@ -266,13 +269,13 @@ function second_compilation() { for config in ${kernel_configs[@]}; do next_cmd+=" --${config}" done + echo "[INFO] Switch to normal kernel for faster compilation." | tee -a ${log_file} + echo "[WARNING] System will be rebooted in 10 seconds!!!" | tee -a ${log_file} + sleep 10 touch ${time_dir}/.flag echo ${next_cmd} >>/etc/rc.d/rc.local chmod +x /etc/rc.d/rc.local - echo "[INFO] Switch to normal kernel for faster compilation." | tee -a ${log_file} - echo "[WARNING] System will be rebooted in 10 seconds!!!" | tee -a ${log_file} grub2-set-default 1 - sleep 10 reboot exit 0 fi -- 2.33.0