3

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?

Pravin Divraniya
  • 4,223
  • 2
  • 32
  • 49
Doppie
  • 95
  • 1
  • 8
  • 1
    [Memory Usage](https://developer.android.com/studio/profile/investigate-ram.html), [memory info 2](http://stackoverflow.com/questions/3170691/how-to-get-current-memory-usage-in-android), [memory info 3](https://developer.android.com/reference/android/app/ActivityManager.html), [Network Log](https://github.com/pragma-/networklog), [TrafficStats API](https://developer.android.com/reference/android/net/TrafficStats.html), [CPU usage](http://stackoverflow.com/questions/12471496/android-how-to-track-the-cpu-usage-of-a-running-app-on-device-programmatically) – denvercoder9 Dec 08 '16 at 22:34

2 Answers2

1

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.]

export of device vitals on Perfecto cloud

Paul Bruce
  • 554
  • 2
  • 7
0

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.

Saveen
  • 4,120
  • 14
  • 38
  • 41
  • Thank you for your answer, however if you read my question correctly it says I am looking for logs every second, which is more or less impossible to do by hand. I am not trying to optimise the performance, already did that ;) – Doppie Dec 15 '16 at 11:06
  • I have already Mentioned ways to check events in every seconds – Saveen Dec 15 '16 at 11:25