Git Product home page Git Product logo

anothermonitor's Introduction

AnotherMonitor

AnotherMonitor monitors and records the CPU and memory usage of Android devices.

.

Warning for Android 7.0+ users

Due to undocumented changes made by Google, on Android 7.0 (August 2016) CPU usage information for processes others than the own AnotherMonitor one will not be available (not even with root access). Rest of the app will work normally. For devices with Android 8.0 (August 2017) AnotherMonitor will not even show the CPU usage of the own app process. Read the below Retriving processes info since Android 7.0 for more info.

Table of Contents

  1. Download ready-to-use app
  2. Details
    1. How CPU and memory usage are obtained
    2. About multi-core devices
    3. Retrieving processes info since Android 5.1
    4. Retrieving processes info since Android 7.0
    5. Retrieving processes info since Android 8.0
  3. Contribute
  4. License

Download ready-to-use app

The app is released on Google Play: https://play.google.com/store/apps/details?id=org.anothermonitor.

Details

AnotherMonitor shows the device CPU and memory status in real time.

It has two main options:

  • It shows a chart and several labels wherein the values of the CPU and memory usage are updated every 0.5, 1, 2 or 4 seconds.
  • It can record on a CSV file the read values for a later usage on a spreadsheet program.

When AnotherMonitor is running on the background it consumes little resources. Then it can monitor and record the CPU and memory usage of other applications on the foreground.

AnotherMonitor adds a Record and Close button to the AnotherMonitor entry on the notification drawer.

How CPU and memory usage are obtained

In order to get the CPU usage the app does NOT make use of the top command from Linux but instead it parses /proc/stat and rest of process folders from the procfs file system and work out the calculations with the user and system time. This is implemented on ServiceReader.class. Find more information about this on Calculating CPU usage of a process in Linux - Stack Overflow.

About multi-core devices

The app does not support showing values for a specific core in multi-core devices. It will show an average of all the device's cores.

Retrieving processes info since Android Lollipop 5.1 (API 22, March 2015)

For devices running Android 5.1.1 it is not possible any more to retrieve the processes list with ActivityManager.getRunningAppProcesses(). This change has not been documented anywhere on the official documentation nor an alternative way to retrieve the list has been provided. Thankfully the community at Stack Overflow came out with some satisfying solution. For devices with Android 5.1 AnotherMonitor now uses the unofficial AndroidProcesses library to retrieve the processes list. The drawback of this is that for some processes there is no way to retrieve the app name nor the icon and instead only the long package name is shown.

Retrieving processes info since Android Nougat 7.0 (API 24, August 2016)

In Android 7.0 Google once again has made undocumented changes and has significantly restricted access to the proc file system. This means that since this new API level it is not possible anymore to retrieve processes info. AnotherMonitor running on devices with Android 7.0 will only show total CPU usage, AnotherMonitor CPU usage and memory usage, but not CPU usage for other processes. Running the app on a rooted device does not make difference. More info on File system changes in Android Nougat - Stack Overflow. Star this Android issue to push Google to implement an alternative API.

Retrieving processes info since Android Oreo 8.0 (API 26, August 2017)

In Android 8.0 Google has further restricted access to the proc file system. Until now it was possible to at least get process info of the process running AnotherMonitor and total CPU usage. This does not work any more. AnotherMonitor running on devices with Android 8.0 will only show memory usage, but not total CPU usage or CPU usage for any process, including the own app process. Running the app on a rooted device does not make difference.

Resolving dependencies

AnotherMonitor only has one external dependency, AndroidProcesses. It is used to retrieve the device processes list and populate the 'Processes' screen.

See the Gradle file for more details.

Contribute

If you have an awesome pull request no matter whether it's a big or small change, send it over! Your link to your GitHub account will be added below.

License

AnotherMonitor makes use of the GNU GPL v3.0 license. Remember to make public your project source code when reusing AnotherMonitor code.

anothermonitor's People

Contributors

antonioredondo avatar djkovrik avatar easyvector avatar nowshad-hasan avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

anothermonitor's Issues

Should processes be shown on Android 7 when root access is available?

I'm not sure if I understood the documentation correct, but should the process list work on android 7.1.2 if root access is available for apps?
I installed AnotherMonitor on my Nexus 5 using LineageOS 14.1 (Android 7.1.2) and activated root but I can not see the list of processes.
I confirmed that root access is working by su on a terminal and ls /proc works fine.

EPERM when trying to create CSV on Android 11

Trying to start a recording on Android 11 (LineageOS 18.1) results in an EPERM error.
According to logcat it seems that Android, with the existing permissions requested and granted, only allows access to Downloads and Documents.

04-09 22:54:14.094  3098  3341 W MediaProvider: Forgot to handle a top level directory in getContentUriForFile?
04-09 22:54:14.096  3098  3341 E MediaProvider: insertFileIfNecessary failed
04-09 22:54:14.096  3098  3341 E MediaProvider: java.lang.IllegalArgumentException: Primary directory AnotherMonitor not allowed for content://media/external_primary/file; allowed directories are [Download, Documents]
04-09 22:54:14.096  3098  3341 E MediaProvider: 	at com.android.providers.media.MediaProvider.ensureFileColumns(MediaProvider.java:2707)
04-09 22:54:14.096  3098  3341 E MediaProvider: 	at com.android.providers.media.MediaProvider.ensureUniqueFileColumns(MediaProvider.java:2372)
04-09 22:54:14.096  3098  3341 E MediaProvider: 	at com.android.providers.media.MediaProvider.insertFile(MediaProvider.java:2981)
04-09 22:54:14.096  3098  3341 E MediaProvider: 	at com.android.providers.media.MediaProvider.insertInternal(MediaProvider.java:3533)
04-09 22:54:14.096  3098  3341 E MediaProvider: 	at com.android.providers.media.MediaProvider.insert(MediaProvider.java:3249)
04-09 22:54:14.096  3098  3341 E MediaProvider: 	at com.android.providers.media.MediaProvider.insertFileForFuse(MediaProvider.java:6717)
04-09 22:54:14.096  3098  3341 E MediaProvider: 	at com.android.providers.media.MediaProvider.insertFileIfNecessaryForFuse(MediaProvider.java:6804)
04-09 22:54:14.097  5975  6002 W System.err: java.io.FileNotFoundException: /storage/emulated/0/AnotherMonitor/AnotherMonitorRecord-2022-04-09-22-54-14.csv: open failed: EPERM (Operation not permitted)
04-09 22:54:14.097  5975  6002 W System.err: 	at libcore.io.IoBridge.open(IoBridge.java:492)
04-09 22:54:14.097  5975  6002 W System.err: 	at java.io.FileOutputStream.<init>(FileOutputStream.java:236)
04-09 22:54:14.097  5975  6002 W System.err: 	at java.io.FileOutputStream.<init>(FileOutputStream.java:186)
04-09 22:54:14.097  5975  6002 W System.err: 	at java.io.FileWriter.<init>(FileWriter.java:90)
04-09 22:54:14.097  5975  6002 W System.err: 	at org.anothermonitor.ServiceReader.record(ServiceReader.java:479)
04-09 22:54:14.098  5975  6002 W System.err: 	at org.anothermonitor.ServiceReader.read(ServiceReader.java:449)
04-09 22:54:14.098  5975  6002 W System.err: 	at org.anothermonitor.ServiceReader.access$100(ServiceReader.java:53)
04-09 22:54:14.098  5975  6002 W System.err: 	at org.anothermonitor.ServiceReader$1.run(ServiceReader.java:85)
04-09 22:54:14.098  5975  6002 W System.err: 	at java.lang.Thread.run(Thread.java:923)
04-09 22:54:14.098  5975  6002 W System.err: Caused by: android.system.ErrnoException: open failed: EPERM (Operation not permitted)
04-09 22:54:14.098  5975  6002 W System.err: 	at libcore.io.Linux.open(Native Method)
04-09 22:54:14.098  5975  6002 W System.err: 	at libcore.io.ForwardingOs.open(ForwardingOs.java:166)
04-09 22:54:14.098  5975  6002 W System.err: 	at libcore.io.BlockGuardOs.open(BlockGuardOs.java:254)
04-09 22:54:14.099  5975  6002 W System.err: 	at libcore.io.ForwardingOs.open(ForwardingOs.java:166)
04-09 22:54:14.099  5975  6002 W System.err: 	at android.app.ActivityThread$AndroidOs.open(ActivityThread.java:7550)
04-09 22:54:14.099  5975  6002 W System.err: 	at libcore.io.IoBridge.open(IoBridge.java:478)
04-09 22:54:14.099  5975  6002 W System.err: 	... 8 more

Manually creating /storage/emulated/0/AnotherMonitor/ doesn't seem to change anything.

I don't have an Android dev environment set up, so I can't test changing the directory to one of the allowed ones to test, but I assume that'd enable it to create the CSV.

Running the latest version of the app from F-Droid.

Other processes with root?

Hello, I am awear that android removed this functionality from normal apps, but have just noticed SystemPanel 2 is able to gather per app CPU usage using root. Is this something that might be doable in Another monitor?

The title (app name) is blocked by its border

Describe the bug

Dear developer!
In the process of using, I found a bug in layout / display. As shown in the figure below, the title (app name) is blocked by its border. This may be an adaptation problem. I suspect it is because display and font size are set to large (mainly due to display size).
Because of some problems with my eyesight, I often use the largest font and display.
103165857-dbaf8580-4857-11eb-9e22-120ae1901389

App version is 3.1.1, my mobile phone is Google Pixel 2, and the screen resolution setting is 1920* 1080. And my font size and display size are the largest ! ! ! Also, my Android system version is 10.0.
The above is a description of the problem. The overall experience of the software is good. You can see that the design is very attentive. Thank you very much for the efforts of the developers all the time. I hope to receive a reply. Thank you so much!!

Expected behavior

I hope that I can see the title fully instead of being blocked.

Steps to reproduce the behavior:

1.use the largest font and display in the display setting
2.open this app
3.this error could be seen

Screenshot

(The blocked part is marked in red)

copy

Environment

  1. Version of AnotherMonitor: 3.1.1
  2. Device : Google Pixel 2,
  3. OS version : Android 10.0

"Follow" an app when it crashes or is killed by Android

Hi, I'm using AnotherMonitor to help track memory leaks in another app I use. Since this app uses a lot of memory, it is often shut down by the system, and sometimes I also forget to re-add the app after it crashes.

When it next crashes again, this means I have no memory trace of the app for debugging. Please consider adding a "Follow" feature, so that when an app crashes, and is later restarted as a new PID, AnotherMonitor automatically starts watching this new PID using the same graph line.

CPU USage

Hi,

This is not a issue but a suggestion. To retrieve an average CPU load for the device, you could run the linux command "uptime" and parse the output.

I hope this will help

How to calculate the percentage?

screenshot from 2018-11-23 15-28-49

I have a question about the way you calculate the percentage, why we must take the totalT instead of total to calculate the CPU usage percentage?

Crashes on start

Unfortunately, it crashes on start. Tested device was an ASUS MemoPad HD7 (ME173X) running Android 4.2.2.

Copyright violation

Hi @AntonioRedondo

I found this app on the Google Play Store. This guy just took your source code and put it on the Store, without warning this is free software...

As you are the owner of the source code, feel free to open a request to google here to remove the false app from the Store, if it's your wish ;)

Don't forget to tell Google that:

  • The app is licensed under GNU GPL v3 license and this guy is violating it;
  • He is falsely claiming he made the app.

Maybe add a screenshot, a link to this repo...

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.