File tree Expand file tree Collapse file tree 1 file changed +6
-4
lines changed Expand file tree Collapse file tree 1 file changed +6
-4
lines changed Original file line number Diff line number Diff line change @@ -376,8 +376,9 @@ cleanupWhenExit() {
376376trap cleanupWhenExit EXIT
377377
378378headInfo () {
379+ local timestamp=$1
379380 colorPrint " 0;34;42" ================================================================================
380- printf ' %s\n' " $( date " +%Y-%m-%d %H:%M:%S.%N " ) [$(( update_round_num + 1 )) /$update_count ]: $( printCallingCommandLine) "
381+ printf ' %s\n' " $timestamp [$(( update_round_num + 1 )) /$update_count ]: $( printCallingCommandLine) "
381382 colorPrint " 0;34;42" ================================================================================
382383 echo
383384}
@@ -567,17 +568,18 @@ printStackOfThreads() {
567568}
568569
569570main () {
570- local update_round_num
571+ local update_round_num timestamp
571572 # if update_count <= 0, infinite loop till user interrupted (eg: CTRL+C)
572573 for (( update_round_num = 0 ; update_count <= 0 || update_round_num < update_count; ++ update_round_num)) ; do
573574 (( update_round_num > 0 )) && {
574575 sleep " $update_delay "
575576 normalOutput
576577 }
577578
578- [[ -n " $append_file " || -n " $store_dir " ]] && headInfo |
579+ timestamp=$( date " +%Y-%m-%d %H:%M:%S.%N" )
580+ [[ -n " $append_file " || -n " $store_dir " ]] && headInfo " $timestamp " |
579581 tee ${append_file: +-a " $append_file " } ${store_dir: +-a " $store_file_prefix$PROG " } > /dev/null
580- (( update_count != 1 )) && headInfo
582+ (( update_count != 1 )) && headInfo " $timestamp "
581583
582584 if [ " $cpu_sample_interval " = 0 ]; then
583585 findBusyJavaThreadsByPs
You can’t perform that action at this time.
0 commit comments