1
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 3 years have passed since last update.

[Java]処理時間の計測方法メモ

Last updated at Posted at 2020-09-22

コード

long hogeStart = System.currentTimeMillis();

// 計測したい処理

long hogeEnd = System.currentTimeMillis();
long hogeTime = hogeEnd - hogeStart;
System.out.println("処理時間: " hogeTime + " ms");

実際の使用

  • 以下をClipy等でスニペット登録しておく
long hogeStart = System.currentTimeMillis();
long hogeEnd = System.currentTimeMillis();
long hogeTime = hogeEnd - hogeStart;
  • 計測したい処理を行入れ替え等で間に挟み込む
    d321cd92f73344804aefe4af36029bfa.gif

  • 複数処理を計測したい場合はhogeを計測したい任意の処理名に置換して使う
    212ada11a3dee2dd897f51e7c50139c0.gif

1
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
1
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?