I have a simple application that contains two implementations which I want to compare(benchmark) with each other in terms of usage during a certain amount of time.
The testing method is equal for both implementations (they both execute exactly the same commands/events) the only difference is the way they process the command and events.
I wish to get a log per second of:
CPU load
Memory usage
Network traffic
The Android Monitor provides everything I need in a graph and logs per second the current CPU load, Memory usage and the TX/RX for network traffic, great!
However I wish to have this all in a text log instead of a live graph. Can someone tell me where I could find such a log? OR if there is no such thing, any suggestions to get similar data?
Doppie, I looked for a solution using out-of-box tools, but there is no good way to use the Android tools to export just the information you want to a text file without lots of work. Logcat is way too verbose and requires conversion, and Dalvik doesn't exactly provide you the every-second control over data collection. I would love to have a simple solution for this too. :/
[Disclaimer: Because I work with Perfecto, I know that the devices in their cloud lab can do this easily, so if you are trying to diagnose a specific problem, you could use their free public cloud and export the device vitals (shown below). This is not a pitch, but since it's free to play, it might help you in the short-term.]
hi first of all if you looking for memory logs. There is one option you can directly go and check that one.
Open Android Device Monitor then checks heap dumps.Check the uses of memory.
Another way to monitor Android Device Monitor then see the Allocation Tracker it gives you details in everyclass where you memory is used.
Expect these things you can directly check your Current logs.
Click Android Monitor and see logcat and second option Monitors.
Monitors gives you Four type of details :
1. Memory usages.
2. CPU how kuch usages of your phone.
3. Network
4. GPU.
Now after these all things. If you still have some problem then need to check your gradle.
What kind of libraries you used.
First of all remove unwanted libraries.
Secondly need to import only useful libraries. Like if you looking for map related things in your app then import only.
compile "com.google.android.gms:play-services-maps:9.4.0"
not this one.
compile 'com.google.android.gms:play-services:9.4.0'
Aware about replication of libraries.
Example : If you using some libraries and that libaray contain appcompt and you are also using same libaray in your app side.Then its better to use that libaray as module.
At last try to use proguard rules.
These are few ways to handle better memory management.
I have made one android app architecture here is link..
Thanks hope this will help you.
Related
My customer raise a problem about our app which is the app is getting slower when using for long time, but our side cannot simulate the problem as we are not in their real working environment, we are not able to solve the problem before knowing the bug. anyone can help?
If it´s a issue that raises "by the passing of time", you should look for any task you might be running and repeating itself.
You should check the different types of functionalities you use.
For example, if your app it´s using a local database:
Look for unclosed cursors.
I/O work
If your are using animations:
Look for skipped frames
Complex view hierarchies
If using background tasks or threading:
I/O work
Unfinished threads
Increasing thread number
If using networking and Webservices:
Problems with your server database
Connection issues
Proxys
...
You could also use something like Firebase + Crashlytics to see if theres any warning raises but gets silently disposed.
Giving some more info about your app and what it does could be useful for elaborating more accurate solution.
A common source of slowing down apps is memory leaks.
on iOS what you can do is to activate Memory management flags on your target and keep a watch on the logs, you can also use Xcode Memory Graph and instruments leak tools to detect leaks.
on Android you can use tools like LeakCanary to be notified when leaks happens.
Once you have a leak detected you can inspect your code to identify the source and better manage memory.
#axierjhtjz mention lots of good starting points.
Does it occur on both iOS and Android, specific devices, vendors?
If it is mainly on a single platform (Android/iOS), on different devices and the main complaint is slowness over time, I would suspect the following:
Memory leak (maybe UI, fragments)
Data persistent data incremental over time or/and more IO operation over time.
If you unable to debug the problem on the customer site, I would suggest to add a remote real time monitoring capabilities over relevant parameters and logs.
A good tool we used in the past was TestFairy. maybe they have a free trial
I looking a tools that can be helps for me to measure my performance in some parts of code in my android application.
Is there any tools for help me?
Now i was written a class that measure my functions in app, but may be is exist more effective methods?
I'm not sure if you are looking for a tool to instrument your code and review your stack trace execution time or something more related to different metrics, but maybe I can help. I'm working on a tool we will release soon, this tool will allow us to monitor our application performance in production using real-time stats. The platform is named FlowUp http://flowup.io/. Just adding an Android library to your project you could monitor your application in production in real-time :)
Using FLowUp you can get information about your application performance in terms of:
Frame time.
Frames per second.
Network consumption.
CPU usage.
Disk usage.
Memory consumption in terms of load and bytes allocated.
And much more metrics. Of course, all these metrics can be reviewed crossing this information with some tags related to the application or the device. For example, you could get information about the network consumption or the frames per second of your app per activity and comparing different app or Android OS version.
This is an screenshot I've taken from our landing page:
Right now we are under development but I recommend you to subscribe to our mail list in http://flowup.io to have access to the first beta we will release soon :)
If you have any metric you'd really like to monitor, please don't hesitate to request it! Maybe we can implement this for you :)
Sure there are tools for that. Try this: Android Systrace.
I want to find the total number of machine instructions of an Android Application. I have explored the Debug.InstructionCount class of Android SDK, but I believe it provides info of Dalvik VM instructions (not the machine level instructions which actually executes on the processor).
I need this info to estimate the time required for the execution of an Android application on a particular processor (using fixed frequency). I am aware of the fact that different type of instructions take variable cycles due to which the computational time cannot be estimated accurately, but I still want to do some experimentation. Thank you
My solution involves writing an instruction set simulator, running the app and counting the instructions. There are already open source avr simulators out there than you can just use/modify for this.
At the end of the day in order to do this you have to follow the instruction flow, so either you actually sim it and that automatically solves how many times the code really goes through a loop and such, or you write a disassembler (which is half of a simulator) and basically follow the code flow in execution order (actually much simpler than a full disassembler or simulator) but you have to deal with all the possible code paths and loops as you find the different paths and count the different paths. With minimal work you could come up with the shortest possible path and know the code could never be faster than that.
My PM wants me to test that how much time my android app is taking on GPRS/edge/3g when i navigate in app.
Is there any tool that i can use as he want me to use a tool that we can run.
he wants that when we use our app on mobile network how much time each page takes to load..
Please help!!
There are several tool provided by Android itself to optimize and monitor Application Performance
One of the tool is TraceView
Documentation:
Traceview is a graphical viewer for execution logs saved by your
application. Traceview can help you debug your application and profile
its performance.
Android also provides Device Monitor is available which comprises of several tools including TraceView
Documentation:
Android Device Monitor is a stand-alone tool that provides a graphical user interface for several Android application debugging and analysis tools.
Give it a try to these tools
Also if you want to find out how to improve performance, go through following blog I usually refer to optimize application performance
http://opensignal.com/blog/2013/07/30/40-developer-tips-for-android-optimization/
Hope this will help
If you are looking for a way to log the time that is spend in some method call you could use TimingLogger. With that you could log every network request and how long it takes to receive the network response.
I am trying to get the CPU usage of a given package. After some research, I found a way to get the CPU usage of a process (reading /proc/[PID]/stat/ information) but I couldn't find a way to go to the package level (a process can run many packages).
I'd say it's impossible to do given that the SDK doesn't offer such APIs to monitor CPU usage (as it does with memory usage) but I'd rather know what you think about this.
Thank you!
You actually can do this, at least using private API's. It's also not a percentage, it's instead stored as a collective "CPU time" which is used to measure power consumption. I did this a while back with a project I worked on. Check out this Google Code project. It requires using private APIs and I make no promises that those APIs still exist, but I did do it at one point.