How to use Android dumpsys framestats - android

I want to measure the FPS of my Android Augmented Reality app. I am trying to follow the documentation for using dumpsys framestats.
This is my procedure:
connect device (Galaxy Tab S5e) via USB to computer (MacBook Pro)
Launch application
Open terminal and enter adb shell dumpsys gfxinfo <PACKAGE_NAME> framestats
I get results. The documentation says that I should get some CSV data (which I do). Here it is:
Flags,IntendedVsync,Vsync,OldestInputEvent,NewestInputEvent,HandleInputStart,AnimationStart,PerformTraversalsStart,DrawStart,SyncQueued,SyncStart,IssueDrawCommandsStart,SwapBuffers,FrameCompleted,DequeueBufferDuration,QueueBufferDuration,
1,270900288236110,270901404902732,9223372036854775807,0,270901406732543,270901407052751,270901407062751,270901480932022,270901488003689,270901488511137,270901489180876,270901502575459,270901504554157,1520000,1026000,
1,270901416955482,270901500288812,9223372036854775807,0,270901507061241,270901507131709,270901507732074,270901524054574,270901524125251,270901524430720,270901524804834,270901531068480,270901534144522,3249000,1831000,
Firstly, why is there only two rows, if:
"Each line of this output represents a frame produced by the app"
If I wait and then rerun the command, I again only get 2 rows. Sometimes the values have updated, but other times they have not...
The documentation says that I can calculate frame time with:
(FRAME_COMPLETED - INTENDED_VSYNC)
So, I thought I could run the ADB command after say, 1 minute, get out a load of frame times and then graph it, but if I only get out 2 frames at a time... and if rerunning the ADB command does not update the data... how can I measure Frametimes? What am I missing here?

I am writing my bachelor thesis and using this adb command to get framerate. In my experience, the framerate data is updated only when the screen is changed. For example, you have a long list. If you don't scroll it, you only see limited framerate data, but if you scroll it, there will be more framerate data (but the maximum number of frames is 122 )

Related

No aggregate frame stats of the Native Activity sample

I run the Native Activity sample on MI Pad 4 Plus, with Android version 8.1.0. It's ok. Then, I run "adb shell dumpsys gfxinfo com.example.native_activity ". It shows a little bit of information, without aggregate frame stats nor HISTOGRAM. Attached please find the screenshot.
Is there any settings needed in the develop phase for this sample to get the gfxinfo?
Screenshot

How can I read and display data from a serial port using ADB shell?

Pardon my google-fu but I am positive nothing very similar was asked before.
I'm new to unix commands, so apologies for my ignorance that maybe displayed.
This is what I have: a custom board running android OS.
This is what I want:
Read data received over the serial port.
Since Android is a Unix-esque, linux-cored, system, I was relying heavily on tutorials about linux system, those bash commands.
By using
dmesg | grep tty
I was able to decide target port name being "ttyAMA0", the baud rate and other parameters are all correct.
So this is what I did then:
cat /dev/ttyAMA0
Nothing happens. I was expecting my screen gets spammed by data received, but nothing.
Was I going the wrong direction at a strategic level or there was some mess-up in detail?
It turns out that cat will only capture for a brief moment right after it was called.
So eventually I settled this issue by repeating "cat" commands at a much higher frequency.

How to make multi-devices dump with AndroidViewClient/dump command?

I'd like to compare the screen of my devices (many) so I'm using AndroidViewClient tool to get the hierarchy of my screens with the dump command in a terminal.
However, my devices are all linked with my computer at the same time, and the dump command seem to work on only one device. So when I use the command, I get the dump of the first device in the device list when I use adb devices.
My goal is to compare screens. So what I want is to specify which device I want to use for my dump in the terminal (and then doing it for all my devices to compare).
Is there a solution of this ? because the only solution I found yet is to make an adb -s [device serial_number] shell uiautomator dump, which offer the possibility to chose which device we want to use among those who are attached, but it produce an xml file (and this is why I need AndroidViewClient's dump, because I don't want the xml file).
In other words, is there a way to specify a device with the dump command in a terminal without disconnecting my USBs successively (keep only one device connected at the same time) ?
Thank you very much in advance !
If I understand correctly, you want to dump different devices that are already available through adb.
Getting help you can see that dump accepts an optional command line parameter which is the serialno
$ dump --help
usage: dump [OPTION]... [serialno]
...
You can also take a look at --multi-device option for culebra that can generate tests that run on many devices at the same time.

How to Compare output of a command dynamically in batch program

I want to poll the state of my android device dynamically using adb in a batch file.
I know that the command "adb devices" or "fastboot devices" gives me the the device id of the device in the respective state and are mutually exclusive. I want to put one of these commands in an if, so that I can judge by comparing the output which state my device is in.
I have seen some if usage in batch file in other posts here, but they weren't helpful as I wasn't able to get the desired output.
Linux has a command called watch, which is perfect for what you want to do. You can simply:
watch adb devices
This will refresh the command every 2 seconds (I think?) by default, but the delay is configurable using a command switch.
In Windows, I would probably use something like this answer: https://stackoverflow.com/a/5483958/1003560

Effect of Frequently executing dumpsys on the Android system

I execute dumpsys meminfo every 2 seconds to sample memory usage of particular Android applications. Sometimes, the application (or even the emulator) crashes while the application is doing dumb things (e.g., rotate the screen back and forth). So, I want to understand how does "executing dumpsys meminfo frequently" affect the state of the whole system.
I have a memory monitoring script that executes dumpsys meminfo a couple times a second and writes the info to a file and it almost never crashes, but I always test using physical devices.
It may be that your emulator just doesn't run fast enough to handle it. Android emulators are incredibly slow.

Categories

Resources