开发者

How to Find out running time?

开发者 https://www.devze.com 2023-01-09 16:57 出处:网络
i need to can we implement showing a label with total time taken for the process to execute in开发者_如何学编程 JAVA? and how? any code spinet?use timestamps

i need to can we implement showing a label with total time taken for the process to execute in开发者_如何学编程 JAVA? and how? any code spinet?


use timestamps

when your executable starts call:

startTime = System.nanoTime();

And store the result in a known location. Then whenever you want to figure out how long you have been running just:

totalTime = System.nanoTime()-startTime;

totaltime will hold the total executtion time in nanoseconds. you could set some sort of timer even to call this and update a label if you want to constantly update it.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号