-4

我如何在java中使用CPU时间作为变量,我需要定义一个动态值随时间推移而增加的变量示例

诠释 CPU 时间;首先:cpuTime = 0,因为但在 20 秒后 cpuTime = 20 和 60 秒后 cpuTime = 60 等等?在哪里,我需要随着时间的推移检查一些情况。例如如果 cpuTime > p-10 做 {}

此致

4

1 回答 1

-2
final long startTime= System.currentTimeMillis();
System.out.println("something");
final long stopTime= System.currentTimeMillis();
System.out.println("endfunction:"+ (stopTime - startTime));
于 2017-08-25T09:35:54.827 回答