Add logs to horizon startup script to time actions

Added logging instructions to horizon startup script to measure time
SM actions (status, start, stop) take.

Test Plan:
PASS: AIO-DX installation, after installation, verify time for SM
      actions are logged in /var/log/horizon_sm.log

Story: 2010940
Task: 50623

Change-Id: I8f5e486bbc8a58776b2c50de060fd46690945992
Signed-off-by: Andy Ning <andy.ning@windriver.com>
This commit is contained in:
Andy Ning 2024-07-19 14:19:07 -04:00
parent b46f3c2d8c
commit 43a520c1e9

View File

@ -132,6 +132,8 @@ status()
RETVAL=3 RETVAL=3
} }
start=$(date +%s%N)
echo "$(date '+%Y-%m-%dT%H:%M:%S:%3N'): action:${1}:start-at:${start: 0:-6} ms" >> /var/log/horizon_sm.log
case "$1" in case "$1" in
start) start)
start start
@ -151,5 +153,9 @@ case "$1" in
RETVAL=1 RETVAL=1
;; ;;
esac esac
end=$(date +%s%N)
echo "$(date '+%Y-%m-%dT%H:%M:%S:%3N'): action:${1}:end-at:${end: 0:-6} ms" >> /var/log/horizon_sm.log
diff=$((end-start))
echo "$(date '+%Y-%m-%dT%H:%M:%S:%3N'): action:${1}:took:${diff: 0:-6} ms" >> /var/log/horizon_sm.log
exit $RETVAL exit $RETVAL