0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

シェル 速度計測

Posted at

速度計測

start_time=`date +%s`
echo -n '開始時刻 ' > speedcheck.log
date "+%Y/%m/%d %H:%M:%S" >> speedcheck.log

echo  'start 計測対象one ' >> speedcheck.log
### 計測したい処理・コマンド ###
sleep 2
### 計測したい処理・コマンド ###
end_time=`date +%s` 
run_time=$((end_time - start_time))
echo $run_time >> speedcheck.log
echo  'end 計測対象one ' >> speedcheck.log

echo  'start 計測対象second ' >> speedcheck.log
### 計測したい処理・コマンド ###
sleep 3
### 計測したい処理・コマンド ###
end_time=`date +%s` 
run_time=$((end_time - start_time))
echo $run_time >> speedcheck.log
echo  'end 計測対象second ' >> speedcheck.log

echo -n '終了時刻 ' >> speedcheck.log
date "+%Y/%m/%d %H:%M:%S" >> speedcheck.log

出力結果

開始時刻 2021/01/08 14:17:28
start 計測対象one 
3
end 計測対象one 
start 計測対象second 
6
end 計測対象second 
終了時刻 2021/01/08 14:17:34
0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?