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() {
376
376
trap cleanupWhenExit EXIT
377
377
378
378
headInfo () {
379
+ local timestamp=$1
379
380
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) "
381
382
colorPrint " 0;34;42" ================================================================================
382
383
echo
383
384
}
@@ -567,17 +568,18 @@ printStackOfThreads() {
567
568
}
568
569
569
570
main () {
570
- local update_round_num
571
+ local update_round_num timestamp
571
572
# if update_count <= 0, infinite loop till user interrupted (eg: CTRL+C)
572
573
for (( update_round_num = 0 ; update_count <= 0 || update_round_num < update_count; ++ update_round_num)) ; do
573
574
(( update_round_num > 0 )) && {
574
575
sleep " $update_delay "
575
576
normalOutput
576
577
}
577
578
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 " |
579
581
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 "
581
583
582
584
if [ " $cpu_sample_interval " = 0 ]; then
583
585
findBusyJavaThreadsByPs
You can’t perform that action at this time.
0 commit comments