如何衡量亚行壳毫秒解决时间?时间、亚行壳

2023-09-08 09:06:42 作者:林空鹿饮溪

我怎么能测量从亚行壳毫秒或纳秒解决时间?

How can I measure time from adb shell with milliseconds or nanoseconds resolution?

使用日期+%。%N 亚行的shell返回 1401546811.N (秒分辨率),而不是其他如 1401547289.231869798 (纳秒级分辨率)。

Usingdate +%.%N from adb shell returns 1401546811.N (seconds resolution) instead of something like 1401547289.231869798 (nanoseconds resolution).

我怎样才能从亚行外壳无论是毫秒或纳秒的分辨率是多少?

How can I get either milliseconds or nanoseconds resolution from adb shell?

有一些终端程序,我可以用它来给我这个? 我能够用测量时间 System.currentTimeMillis的() System.nanoTime()从Android应用程序code本身,但我还需要从一些在亚行外壳

Is there some terminal program that I can use to give me this? I am able to measure time using System.currentTimeMillis() and System.nanoTime() from Android application code itself, but I also need something from within adb shell.

推荐答案

根据不同的外壳版本,你可以使用 EPOCHREALTIME 环境变量:

Depending on the shell version you could use EPOCHREALTIME environment variable:

$ adb shell echo \$EPOCHREALTIME
1402003597.273141
 
精彩推荐
图片推荐