Skip to content

Instantly share code, notes, and snippets.

@vector4wang
Last active May 28, 2019 11:36
Show Gist options
  • Save vector4wang/4794565923420ede8fab87e76f1ad593 to your computer and use it in GitHub Desktop.
Save vector4wang/4794565923420ede8fab87e76f1ad593 to your computer and use it in GitHub Desktop.
[code timer statistics] #Java
Timer t1 = new Timer();
t1.start(); // 针对每一个方法需要 new一个,并且需要制定start()和stop()
fun1();
t1.sotp;
Timer t2 = new Timer();
t2.start()
fun2();
t2.stop();
Timer t3 = new Timer();
t3.start();
fun3();
t3.stop();
Timer.print();// 最后将所有的方法,调用的次数与总耗时打印出来
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment