了解dumpsys gfxinfo的时间信息 [英] Understand the time information of dumpsys gfxinfo

查看:91
本文介绍了了解dumpsys gfxinfo的时间信息的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想了解 dumpsys gfxinfo 日志上的时间信息.它看起来像这样:

I want to understand the time information on the dumpsys gfxinfo log. It looks like this:

Applications Graphics Acceleration Info:

Uptime: 16264702 Realtime: 28169900

谁能告诉我如何将这些数字与 System.currentTimeMillis() 相关联?

Can anyone tell me how to associate these figures with System.currentTimeMillis()?

推荐答案

来自 ActivityManagerService.java:

    long uptime = SystemClock.uptimeMillis();
    long realtime = SystemClock.elapsedRealtime();
    pw.println("Applications Graphics Acceleration Info:");
    pw.println("Uptime: " + uptime + " Realtime: " + realtime);

同样来自 SystemClock 描述:

三种不同的时钟可用,不要混淆:

Three different clocks are available, and they should not be confused:

System.currentTimeMillis() 是标准的挂钟"(时间和date) 表示自纪元以来的毫秒数.挂钟可以由用户或电话网络设置(参见 setCurrentTimeMillis(long)),所以时间可能会不可预测地向后或向前跳跃.这个钟仅应在与现实世界日期对应时使用,并且时间很重要,例如在日历或闹钟应用程序中.间隔或经过时间测量应使用不同的时钟.如果您正在使用 System.currentTimeMillis(),请考虑收听ACTION_TIME_TICKACTION_TIME_CHANGEDACTION_TIMEZONE_CHANGED意图广播以找出时间何时改变.

System.currentTimeMillis() is the standard "wall" clock (time and date) expressing milliseconds since the epoch. The wall clock can be set by the user or the phone network (see setCurrentTimeMillis(long)), so the time may jump backwards or forwards unpredictably. This clock should only be used when correspondence with real-world dates and times is important, such as in a calendar or alarm clock application. Interval or elapsed time measurements should use a different clock. If you are using System.currentTimeMillis(), consider listening to the ACTION_TIME_TICK, ACTION_TIME_CHANGED and ACTION_TIMEZONE_CHANGED Intent broadcasts to find out when the time changes.

uptimeMillis() 以系统启动后的毫秒数计算.当系统进入深度睡眠(CPU 关闭、显示暗、设备等待外部输入)时,该时钟停止,但不受时钟缩放、空闲或其他节能机制的影响.这是大多数时间间隔计时的基础,例如 Thread.sleep(millls)Object.wait(millis)System.nanoTime()>.该时钟保证是单调的,适用于间隔不跨越设备休眠时的间隔计时.大多数接受时间戳值的方法当前都期望 uptimeMillis() 时钟.

uptimeMillis() is counted in milliseconds since the system was booted. This clock stops when the system enters deep sleep (CPU off, display dark, device waiting for external input), but is not affected by clock scaling, idle, or other power saving mechanisms. This is the basis for most interval timing such as Thread.sleep(millls), Object.wait(millis), and System.nanoTime(). This clock is guaranteed to be monotonic, and is suitable for interval timing when the interval does not span device sleep. Most methods that accept a timestamp value currently expect the uptimeMillis() clock.

elapsedRealtime()elapsedRealtimeNanos() 返回系统启动后的时间,包括深度睡眠.该时钟保证是单调的,即使在 CPU 处于省电模式时也会继续计时,因此是通用间隔计时的推荐基础.

elapsedRealtime() and elapsedRealtimeNanos() return the time since the system was booted, and include deep sleep. This clock is guaranteed to be monotonic, and continues to tick even when the CPU is in power saving modes, so is the recommend basis for general purpose interval timing.

这篇关于了解dumpsys gfxinfo的时间信息的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆