adb shell command to find the device RAM - android

I am trying to find device RAM (512 MB or 1GB) using adb shell commands.
Following commands giving more details about the free,used & total memory. But how to find the device overall RAM?
adb shell "cat /proc/meminfo"
adb shell dumpsys meminfo
adb shell procrank

So it looks to me that MemTotal is probably the field you are looking for:
MemTotal — Total amount of physical RAM, in kilobytes.
While it is not the strictly Android, another Linux flavour CentOS provides the following page regarding /proc/meminfo. It seems that Red Hat, and other variants also describe it similarily.
Is there something that is making you suspect that this is not the physical RAM? On my device the value reported for MemTotal matches what I expect.

People who post answers often forget that Windows users don't have access to grep, cat, etc. Add shell to the beginning of your pipe.
.\adb.exe -s whichever-device shell "cat /proc/meminfo | grep MemTotal"
This is assuming you're connected to multiple devices. If you're only connected to one, you can remove -s whichever-device (usually the ip if you're connected by wifi or the device number from the device list if connected by wire.).

Related

Get chip name of the android device using adb?

Is there an easy way to get the chip name like the MediaTek SoCs (ARMv5 MT1000 ..) of an Android device using adb shell?
I'm trying to run "adb shell cat system/build.prop" but I don't found the chip or SoC name.
Any Help for that!
To get CPU info of a device via adb try,
adb shell cat /proc/cpuinfo
You will get your soc model number from this you can search it on the Qualcomm product list to find SOC name
adb shell cat /proc/cpuinfo | grep hardware
In some cases you will directly get your product name
At least on Samsung S8, I get the SoC name (exynos8895) by running
adb shell getprop ro.hardware ro.hardware.chipname
Also, I get samsungexynos8895 from
adb shell getprop ro.hardware

Getting cpu and memory usage for a period of time

I have some old shell scripts that needs to be executed on an android device but the command to fetch the total cpu, memory and swap usage is top. More specific it is:
top -m 1 -d 1.0 -n $duration
Now I have been looking to find a replacement for this and I found out that I can use dumpsys. The problem what I have is that I want to give a timeout like this:
dumpsys -t 20 cpuinfo
I checked this site: https://developer.android.com/studio/command-line/dumpsys.html but didn't find out why this doesn't work. Even when I try the help I get the same error
dumpsys --help
Can't find the service: --help
Does someone know what is going on? My current android version is 6.0.1 if this is important.
Thanks in advance!
It is true that dumpsys --help does not work. I think there is a mistake in their document. However, below works:
# adb shell dumpsys input
# adb shell dumpsys -l
Add permission on your manifest "android.permission.DUMP".or
There's another (hacky) way to access dumpsys without rooting your device - through adb shell.
This will require allowing USB debugging, and finding the port of the adb service.
Enable USB debugging on your device. This option is found under Settings -> Developer Options.
Connect your device to a PC, and run the following command from the PC's shell/command line: adb tcpip 12345. Then, from your devices shell, issue the command adb connect localhost:12345 from your application. You can now disconnect the device from USB. Alternatively, you can scan the ports on your device one by one without USB connection, using adb connect localhost: and find the port adb service is listening to.
Authorize USB debugging from the pop up confirmation dialog, if prompted. Check the "always" checkbox to do not require this step again.
Now, when you have access to the adb service, use adb shell dumpsys ... from your application code to get whatever service dump you need.

How to determine Android GPU Clock?

It is possible to dynamically query an Android device for the current CPU clock similar to what is mentioned in what follows.
adb shell "cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_cur_freq"
However, it seems like there is not a similar option for GPU. I was wondering if there is a way, anything, to do the same for GPUs. Any help is greatly appreciated.
(CPU/GPU frequencies are not good indicators of speed. I mainly need them for some study on DVFS)
How I found the GPU freq and % for Android Galaxy S5 on OSX/Linux
Attach your phone for debugging.
In terminal: ./adb -s shell dumpsys SurfaceFlinger
Find the line with "GLES:"
The GPU name is there. For the galaxy s5 it is "Mali-T628"
./adb shell find "/sys/" -type f
Search through and find the "mali" folder
use adb shell cat to investigate what the files contain
Used ./adb shell cat /sys/devices/11800000.mali/utilization, which lists the gpu used % as an integer
Used ./adb shell cat /sys/devices/11800000.mali/clock, which lists the gpu freq as an integer
Use those integers in your perf reporting
As Amin mentioned, the best solution is using the profiler. I used Android profiler (like) to measure the performance.

adb command to get internal storge

adb shell dumspys meminfo, vmstat commands gives the RAM size available on the device. Also, I have used adb shell df, which provides available memory in different partitions of the device. The problem with 'df' is that it provides different partitions and values on different versions.
Is there any command in adb/linux which display the free internal or sdcard memory of the device?
Simply use adb shell df /data.
You can also use adb shell df /system for system occupied storage.

get number of processes using adb

I have a LG H810 device and I want to get the total number of processes that are currently running on the device using adb command.
I don't want to see the actual processes, I only want the total number of running processes.
Thanks
I guess this is what you are looking for , to get Process Count!
adb shell ps r|wc
BTW: you might want wc to count lines, so wc -l in that case.
like :
adb shell ps r|wc -l

Categories

Resources