3
4

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 1 year has passed since last update.

pythonで処理時間を計測する。

Last updated at Posted at 2022-01-21

実行時間についていつか使いそうなので、メモとして残しておきます。

#code
perf_counterを使うのがよさそう。真面目に必要になったときに検討します。

meas.py
import time

def start_time ():
    start = time.perf_counter()
    return start

def end_time (start):
    end = time.perf_counter()
    result = end - start
    print ('test time:','{:.3f}'.format(result))

turn_on_time = start_time()
#プログラム処理中
end_time(turn_on_time)

3
4
4

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
3
4

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?