From f573581caad5c91a2f06a9500629eaa45066638e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Ros?= Date: Tue, 5 Jun 2018 17:18:00 -0700 Subject: [PATCH 1/2] Forwarding SIGINT to perf --- src/performance/perfcollect/perfcollect | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/src/performance/perfcollect/perfcollect b/src/performance/perfcollect/perfcollect index ffed618..ee3f750 100755 --- a/src/performance/perfcollect/perfcollect +++ b/src/performance/perfcollect/perfcollect @@ -649,6 +649,24 @@ RunSilent() fi } +# Forwards SIGINT to the child process +RunForwardSilent() +{ + $* > /dev/null 2>&1 & sleep 1 + pid=$! + + for (( ; ; )) + do + if [ "$handlerInvoked" == "1" ] + then + kill -INT $pid + break; + else + sleep 1 + fi + done +} + InitializeLog() { # Pick the log file name. @@ -1734,7 +1752,7 @@ DoCollect() # Start perf record. if [ "$usePerf" == "1" ] then - RunSilent $perfcmd $collectionArgs + RunForwardSilent $perfcmd $collectionArgs else # Wait here until CTRL+C handler gets called when user types CTRL+C. LogAppend "Waiting for CTRL+C handler to get called." From 79355e67bc841f27a6288d361d7455f42602f12b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Ros?= Date: Tue, 5 Jun 2018 17:28:32 -0700 Subject: [PATCH 2/2] Fixing tabs --- src/performance/perfcollect/perfcollect | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/performance/perfcollect/perfcollect b/src/performance/perfcollect/perfcollect index ee3f750..c808107 100755 --- a/src/performance/perfcollect/perfcollect +++ b/src/performance/perfcollect/perfcollect @@ -652,7 +652,7 @@ RunSilent() # Forwards SIGINT to the child process RunForwardSilent() { - $* > /dev/null 2>&1 & sleep 1 + $* > /dev/null 2>&1 & sleep 1 pid=$! for (( ; ; ))