Android - Can't use traceview - android

I am trying to use traceview to run some profiling against an Android application. I have wrapped the code that I want to trace with the following lines:
Debug.startMethodTracing("xxx");
// code
Debug.stopMethodTracing();
It successfully generated a trace file, that I pulled from sdcard using the following command line:
./adb pull /sdcard/xxx.trace
However when running traceview like this:
./traceview /.../xxx.trace
I am getting the following error message:
Usage: java
com.android.traceview.MainWindow [-r]
trace -r regression only
I cannot understand this error message and I didn't find anything useful on Google.
Any help would be much appreciated.
Thanks!

make sure that Debug class you imported is this one : android.os.Debug
or do this :
android.os.Debug.startMethodTracing("xxx");
android.os.Debug.stopMethodTracing();

Related

Android Cuttlefish Device Not Booting - launch_cvd Command Not Working (Error: run_cvd returned 23)

I have built a custom ROM that I'm testing on Android Cuttlefish, but when I go to boot the device on the command line using the launch_cvd command, I get the following errors:
[assemble_cvd ... fetcher_config.cpp:212] Could not find file ending in kernel
[assemble_cvd ... fetcher_config.cpp 212] Could not find file ending in initramfs.img
run_cvd returned 23
Subprocess 39641 exited with error code: 23
The main issue seems to lie in the 'error 23' that is returned by run_cvd.
I have tried Google searching and browsing popular forums where Android is built and debugged (XDA Forums, Reddit, StackOverflow, the Android Building Google Group, YouTube, and the web in general). I have also posted on Reddit and will post on the Android Building Google Group. Additionally, I have looked through the source code for Cuttlefish on Google's Git repo to find why the program is outputting the error to no avail.
Lastly, I read through the logfiles of Cuttlefish to see the errors outputted by Cuttlefish. The kernel.log file seems to show the kernel booted successfully (despite the command line saying that it couldn't find the kernel file), I would imagine the same is true of initramfs.img, but I have no way of confirming that initramfs.img was successfully found by launch_cvd. The logcat file is empty (likely because the Cuttlefish failed to boot) and launcher.log simply reproduces the output on the command line (which contain the four errors I listed above).
Could anyone help me troubleshoot this issue? Your help would be greatly appreciated!
Do ps -A | grep crosvm to see if crosvm is running already.
If it is do stop_cvd || true or kill crosvm process with process PID.

What is LT_INIT(...) in Linux?

I'm customizing linphone (open source voip dialer).
When I build linphone-android from source, some errors occurr.
Problematic path is "submodules/libilbc-rfc3951/Makefile".
Error is like this:
./configure: line 2521: syntax error near unexpected token `disable-static'
./configure: line 2521: `LT_INIT(disable-static)'
What is 'LT_INIT(disable-static)'?
And... What should I do about this?
It looks very complicated to me.
As Aduait had mentioned, http://www.gnu.org/software/libtool/manual/html_node/LT_005fINIT.html will explain what is LT_INIT(...).
Regarding the LinPhone-Android build issue, You got to remove submodules/libilbc-rfc3951/ and try to run make or prepare_source.sh respectively. It will fetch the right code for compilation.
I personally faced the same issue and the above method fixed my problem.
I was able to defeat this one by going to submodules/libilbc-rfc3951/ and running these commands:
aclocal
autoconf
automake --add-missing

Android: systrace in cygwin does not write to output file, plus generates garbage

I'm getting below error with systrace tool provided by android Jelly bean SDK on windows 2003 PC with python 2.7
executing below command in cygwin editor
python systrace.py --time=10 -o mynewtrace.html
▒GS{▒&▒izAr ▒▒9▒Zww▒▒▒Hj▒▒K▒[X▒▒▒4▒i▒▒D▒▒#▒"▒▒▒]▒lJ▒!▒▒)K▒dKY▒▒:\▒?▒ ▒?w%{D▒g▒?Q&▒wQ▒▒p%'T▒▒oE▒(▒:▒▒k▒▒◄▒▒)▒2▒?▒%▒▒4▒w^▒ ▒~▒▒/▒g▒7?M?▒c▒r#/▒oDE▒tg▒▒N▒▒S'\▒▒▒▒↓▒▒GY▒x▒↓▒2D'↓CN▒{▒f2?pu▒▒?▒▒▒▒(g▒▒9▒f▒<A▒Hz▒+P/▒▒sTU▒b▒?{▒/▒▒▒▒4u_▒▒?▒!0▒▒▒▒1▒▒▒▒#1 ▒▒▒s ▒↓
Y▒;♥♥▒▒3G▒H ▒▒&v▒▒:♦▒{▒▒*▒?7▒▒=▒"▒♥▒▒▒▒▒♥▒▒▒<▒:n?♥<i▒▒► ▒v/▒▒↓▒/♣c▒.▒)#Ou/▒▒O▒▒?▒▒▒%▒A,4+▒x▒▒▒#▒*gfσ▒7▒♣▒▒EtV▒3▒▒▒▒▒r♦▒kQ▒a♦↓▒▒|/:Iy▒{▒◄x8y▒▒▒h▒M▒▒▒G|▒▒"#⌂▒▒gK-▒▒▒'▒▒(▒▒FfN▒▒▒▒▒↑▒▒~4▒⌂▒T?r▒▒▒▒▒▒!▒?▒?▒▒▒▒~CaO▒
ho▒▒L▒H▒9▒▒▒Lh▒▒▒iY▒$4▒d▒▒.C▒▒►#!↓↑▒▒▒▒RQ▒;c▒▒▒?#3▒g▒▒▒▒?G▒y▒▒?Fb▒B=▒▒W|▒%Zc▒▒Q▒UY?♣▒c▒▒$v▒▒▒?▒8▒4v▒h▒▒▒I↑▒`▒Kb▒,▒▒Y▒▒#▒+▒▒▒▒=▒▒▒▒▒▒▒▒
e▒*▒e⌂▒▒"▒P▒!↑▒}▒n♦▒IW ▒▒▒
▒⌂▒)♠K▒?ln▒D♠:z▒:♥▒xA>▒▒LGX↑▒O▒▒W9Z▒▒p▒8▒xG$?▒▒;▒,▒M▒▒▒▒`▒kH▒▒▒kd9▒4t6▒xQH%o▒▒▒▒▒▒O▒▒▒#▒▒▒x▒3▒▒0◄~▒♦▒▒*#W▒▒▒_▒▒_y▒▒▒04▒▒▒▒P-R2K▒▒▒(?B▒e9▒g▒8M37A4▒▒n▒▒#▒▒m▒I▒.▒=▒3▒c▒▒?▒▒s▒▒▒j▒4e▒▒*E▒Q1N▒▒▒▒▒▒▒qy▒▒▒▒▒▒▒▒▒▒▒▒aN?▒_▒▒▒▒▒28_~▒]e♦▒▒▒▒&g♥v3►p▒p▒`▒J▒/▒X⌂▒{▒▒▒-▒▒▒rI▒%Q▒⌂▒▒q▒▒▒▒?▒▒▒▒/hE▒▒▒?▒▒▒▒▒▒▒7▒6▒W▒j▒▒▒w▒▒O▒▒>▒▒▒▒?▒xy▒▒v▒▒▒⌂?4▒T▒a▒◄▒c▒▒▒O7▒⌂v⌂|▒▒rL▒*▒♠▒▒▒#▒▒▒▒~}▒▒
▒K▒H2▒▒▒^l▒RI▒c^$9S$▒=▒▒BI:▒6cj+▒▒▒#
>▒▒▒&f ▒▒▒$▒▒◄▒?▒r▒C▒Ze♥↓▒%▒▒&▒#6▒CE▒▒◄+G♣-▒▒]▒ ▒▒[c▒b\▒MBhu▒O▒▒2▒!+y▒▒▒▒lDt▒U▒▒e▒I5▒\▒▒=▒▒▒▒▒▒T▒T▒▒▒♦^▒▒v▒k▒?▒-▒▒*▒)▒9▒t?▒▒cq▒,$▒▒▒
▒▒+▒▒OM▒#▒▒▒=?▒,?d;k▒♥p▒▒sd▒w▒▒▒▒▒I▒▒p▒nk▒▒D▒▒J▒Gh▒AJ▒B
▒t▒?%D▒q▒yUfyb▒?▒▒▒o▒/q*▒▒▒%i▒▒▒▒▒?>▒v▒/▒>_-▒▒~▒▒▒▒cu▒▒▒▒▒/▒▒|▒~▒▒v3▒▒▒_▒v▒~y"▒▒?▒▒▒▒▒▒_?▒▒▒/Oj▒>▒▒▒▒~▒\▒▒▒▒▒▒▒#▒▒t▒▒2Z▒K▒8_▒▒▒J▒*▒▒▒▒^a▒▒▒4W-▒▒▒TAn error occured while capturing the trace. Output file was not written.
Any environment variable should be added for python?? if yes which variable has to be added?
Can anyone help me in resolving this issue?
Thanks & regards
The reason it's not working on Cygwin is because the stream coming from the device actually
has two carriage returns before every line feed. You can see this by putting in a call to 'print repr(out) after reading from adb.stdout.
You just need to update systrace.py as follows to work around this:
if sys.platform == 'cygwin':
out = out.replace('\r\r\n', '\n')
else:
out = out.replace('\r\n', '\n')
I posted a patch at https://android-review.googlesource.com/55170 to fix this.

traceview command run issue

I am trying to use traceview to run some profiling against an Android application. I have wrapped the code that I want to trace with the following lines:
Debug.startMethodTracing("xxx");
// code
Debug.stopMethodTracing();
It successfully generated a trace file, that I pulled from sdcard using the following command line:
$./traceview ~/code/packages/performance_trance.trace
Exception in thread "main" java.lang.NoSuchMethodError: java.util.Arrays.copyOf([II)[I
at com.android.traceview.ProfileProvider.getColumnWidths(ProfileProvider.java:143)
at com.android.traceview.ProfileView.<init>(ProfileView.java:85)
at com.android.traceview.MainWindow.createContents(MainWindow.java:109)
at org.eclipse.jface.window.Window.create(Window.java:431)
at org.eclipse.jface.window.Window.open(Window.java:790)
at com.android.traceview.MainWindow.run(MainWindow.java:65)
at com.android.traceview.MainWindow.main(MainWindow.java:269)
I cannot understand this error message and I didn't find anything useful on Google.
Any help would be much appreciated.
Thanks!
try to open the file with your eclipse (with adt plugin)

how to see more infomation in ndk-gdb when the program breakdown

I use eclipse and ndk-gdb to debug my AndroidNDK program,but i find a problem,the ndk-gdb tools seems do not have the function of "saving the stack" when the program breakdown,i cannot find detail infomation from the ndk-gdb,it does not point which function,which class and which line,just give the info like this:*Program received signal SIGSEGV, Segmentation fault.0xafd0cda4 in memcpy ()
from D:/android/ndk/samples/mango_d/obj/local/armeabi/libc.so*
so , i was wondering if there is a way to see more infomation(the last sentence the program called or others) when the program breakdown,thank you fist
You could try utilize the ndk-stack program, consult to the doc in the ndk, docs/NDK-STACK.html
If you compile the c source by
ndk-build NDK_DEBUG=1 APP_OPTIM=debug
you should be able to call something similar like this one
adb -s %TARGET_INSTALL% logcat DEBUG:I | ndk-stack -sym ./obj/local/armeabi-v7a
that one will give you the source code and line stack trace for the seg-fault.

Categories

Resources