开发者

How to Find out running time?

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

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜