Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to get Android system uptime and realtime from command line?

I'm writing a script containing several "adb shell" command. I also want to record the time when program execute these command in a form of realtime and uptime. I know I can get uptime and realtime through SystemClock:

SystemClock.uptimeMillis();
SystemClock.elapsedRealtime();

Is there any way I can get these information from the command line?

Thanks a lot!

like image 551
Wei Yang Avatar asked Aug 08 '13 20:08

Wei Yang


People also ask

What is Dumpsys command?

dumpsys is a tool that runs on Android devices and provides information about system services. You can call dumpsys from the command line using the Android Debug Bridge (ADB) to get diagnostic output for all system services running on a connected device.

What is ADB shell Dumpsys Gfxinfo?

dumpsys gfxinfo is a shell command you can use on the device via the command line. It provides you a dump of the rendering information of your current application instance and included in that dump is your app's Jank info.

Can I Enable USB debugging using ADB?

To use adb with a device connected over USB, you must enable USB debugging in the device system settings, under Developer options. To use adb with a device connected over Wi-Fi, see Connect to a device over Wi-Fi. On Android 4.2 and higher, the Developer options screen is hidden by default.


1 Answers

Try:

adb shell cat /proc/uptime
like image 161
Diego Torres Milano Avatar answered Nov 11 '22 08:11

Diego Torres Milano