A performance monitor SDK for Android application

Related tags

SDK OMagnifier
Overview

OMagnifier

OMagnifier is an Android APM SDK that can be used to monitor the app performance.

Features Support

  • Frame rate monitor: floating window for showing fps
  • Memory usage metrics monitor: monitor and collect the memeory usage metrics
  • Memory usage viewer
  • Battery usage monitor

APIs

Frame rate monitor

  1. Start frame rate monitor
Magnifier.startMonitorFPS(
    FPSMonitorConfig.Builder(this.application)
        .lowPercentage(40 / 60f)  // show red tips, (2.0f / 3.0f) by default
        .mediumPercentage(50 / 60f) // show yellow tips, (5.0f / 6.0f) by default
        .refreshRate(60f) // defaultDisplay.refreshRate by default
        .build()
)
  1. Stop frame rate monitor
Magnifier.stopMonitorFPS()

Memory usage monitor

The mectrics we support now:

  • HeapMemoryInfo: heap memory and vss/pss memory
  • FileDescriptorInfo: file readlink and max open file count
  • ThreadInfo: thread count and thread stack trace
  1. Start Memory usage metrics monitor
MemoryMonitorConfig.Builder()
    .enableExceedLimitSample(0.8f, // the benchmark for Exceed_Limit type sampler, if we reach out 80% the max, collect the metrics, 0.8f by default
        10000 // the threshold for Exceed_Limit type sampler, 10s by default
    )
    .enableTimingSample(60 * 1000) // threshold for the timing checker, 1 min by default
    .onSampleListener(object : MemoryMonitor.OnSampleListener {
        override fun onSampleHeap(
            heapMemoryInfo: HeapMemoryInfo,
            sampleType: MemoryMonitor.SampleType
        ) {
            Log.d(TAG, "heapMemoryInfo:$heapMemoryInfo,sampleType:$sampleType")
        }

        override fun onSampleFile(
            fileDescriptorInfo: FileDescriptorInfo,
            sampleType: MemoryMonitor.SampleType
        ) {
            Log.d(TAG, "fileDescriptorInfo:${fileDescriptorInfo.fdMaxCount},sampleType:$sampleType")
        }

        override fun onSampleThread(
            threadInfo: ThreadInfo,
            sampleType: MemoryMonitor.SampleType
        ) {
            Log.d(TAG, "threadInfo:${threadInfo.threadsCount},sampleType:$sampleType")
        }
    }).build()
  1. Collect the memory usage metrics immdiately
Magnifier.dumpMemoryImmediately(object : MemoryMonitor.OnSampleListener {
    override fun onSampleHeap(
        heapMemoryInfo: HeapMemoryInfo,
        sampleType: MemoryMonitor.SampleType
    ) {
        Log.d(TAG, "heapMemoryInfo:$heapMemoryInfo,sampleType:$sampleType")
    }

    override fun onSampleFile(
        fileDescriptorInfo: FileDescriptorInfo,
        sampleType: MemoryMonitor.SampleType
    ) {
        Log.d(TAG, "fileDescriptorInfo:${fileDescriptorInfo.fdMaxCount},sampleType:$sampleType")
    }

    override fun onSampleThread(
        threadInfo: ThreadInfo,
        sampleType: MemoryMonitor.SampleType
    ) {
        Log.d(TAG, "threadInfo:${threadInfo.threadsCount},sampleType:$sampleType")
    }
})
  1. Stop frame rate monitor
Magnifier.stopMonitorMemory()

Demo

The demo is under Module app.

  1. Install the app
  2. Run the app
  3. Click the button for testing

Contributing

This project welcomes contributions and suggestions. Most contributions require you to agree to a Contributor License Agreement (CLA) declaring that you have the right to, and actually do, grant us the rights to use your contribution. For details, visit https://cla.opensource.microsoft.com.

When you submit a pull request, a CLA bot will automatically determine whether you need to provide a CLA and decorate the PR appropriately (e.g., status check, comment). Simply follow the instructions provided by the bot. You will only need to do this once across all repos using our CLA.

This project has adopted the Microsoft Open Source Code of Conduct. For more information see the Code of Conduct FAQ or contact [email protected] with any additional questions or comments.

Security reporting

Code of conduct

License

Copyright (c) Microsoft Corporation. All rights reserved.

Licensed under the MIT license.

You might also like...
AWS SDK for Android. For more information, see our web site:

AWS SDK for Android For new projects, we recommend interacting with AWS using the Amplify Framework. The AWS SDK for Android is a collection of low-le

新浪微博 Android SDK

ReadMe 公告: 鉴于线上服务器出现问题,推荐下载本地aar后上传到自己公司的服务器,保证后续服务稳定, 我们也将尽快重新提供一个稳定的地址供大家使用。 新包地址:https://github.com/sinaweibosdk/weibo_android_sdk/tree/master/2019

Official Appwrite Android SDK 💚  🤖
Official Appwrite Android SDK 💚 🤖

Appwrite Android SDK This SDK is compatible with Appwrite server version 0.8.x. For older versions, please check previous releases. Appwrite is an ope

This App is sending Face capture data over network, built around the latest Android Arcore SDK.
This App is sending Face capture data over network, built around the latest Android Arcore SDK.

AndroidArcoreFacesStreaming From any Android phone ArCore compatible, using this app will send over TCP 5680 bytes messages: The first 5616 bytes is a

Trackingplan for Android SDK
Trackingplan for Android SDK

With Trackingplan for Android you can make sure that your tracking is going as you planned without changing your current analytics stack or code.

Desk360 Mobile Chat SDK for Android

Desk360 Chat Android SDK Introduction Desk360 Live Chat SDK is an open source Android library that provides live support to your customers directly fr

Storyblok Kotlin Multiplatform SDK sample (Android, JVM, JS)

storyblok-mp-SDK-sample *WIP* ... a showcase of the Storyblok Kotlin Multiplatform Client SDK. (Android, JVM, JS, iOS, ...) What's included 🚀 • About

A demo of Rongcloud uniapp sdk integration for compiling debug-apk in Android Studio

Rongcloud-uniapp-sdk-demo A demo of Rongcloud uniapp sdk integration for compiling debug-apk in Android Studio 这是一个为了给uniapp在Android平台打出debug-apk的demo

StreamPack: live streaming SDK for Android based on Secure Reliable Transport

StreamPack: live streaming SDK for Android based on Secure Reliable Transport (SRT) StreamPack brings the best audio/video live technologies together

Owner
Microsoft
Open source projects and samples from Microsoft
Microsoft
Segmenkt - The SegmenKT Kotlin SDK is a Kotlin-first SDK for Segment

SegmenKT Kotlin SDK The SegmenKT Kotlin SDK is a Kotlin-first SDK for Segment. I

UNiDAYS 0 Nov 25, 2022
Frogo SDK - SDK Core for Easy Development

SDK for anything your problem to make easier developing android apps

Frogobox 10 Dec 15, 2022
HubSpot Kotlin SDK 🧺 Implementation of HubSpot API for Java/Kotlin in tiny SDK

HubSpot Kotlin SDK ?? Implementation of HubSpot API for Java/Kotlin in tiny SDK

BOOM 3 Oct 27, 2022
AWS SDK for Android. For more information, see our web site:

AWS SDK for Android For new projects, we recommend interacting with AWS using the Amplify Framework. The AWS SDK for Android is a collection of low-le

AWS Amplify 976 Dec 29, 2022
Countly Product Analytics Android SDK

Countly Android SDK We're hiring: Countly is looking for Android SDK developers, full stack devs, devops and growth hackers (remote work). Click this

Countly Team 648 Dec 23, 2022
Android Real Time Chat & Messaging SDK

Android Chat SDK Overview Applozic brings real-time engagement with chat, video, and voice to your web, mobile, and conversational apps. We power emer

Applozic 659 May 14, 2022
Evernote SDK for Android

Evernote SDK for Android version 2.0.0-RC4 Evernote API version 1.25 Overview This SDK wraps the Evernote Cloud API and provides OAuth authentication

Evernote 424 Dec 9, 2022
Air Native Extension (iOS and Android) for the Facebook mobile SDK

Air Native Extension for Facebook (iOS + Android) This is an AIR Native Extension for the Facebook SDK on iOS and Android. It has been developed by Fr

Freshplanet 219 Nov 25, 2022
Android Chat SDK built on Firebase

Chat21 is the core of the open source live chat platform Tiledesk.com. Chat21 SDK Documentation Features With Chat21 Android SDK you can: Send a direc

Chat21 235 Dec 2, 2022
Liquid SDK (Android)

Liquid Android SDK Quick Start to Liquid SDK for Android This document is just a quick start introduction to Liquid SDK for Android. We recommend you

Liquid 17 Nov 12, 2021