Skip to main content

MagnaX - Real-time collection tool for Android/iOS performance data.

Project description

English | 中文 | FAQ

MagnaX

magnax preview

🔎Preview

MagnaX - Real-time collection tool for Android/iOS performance data.

Quickly locate and analyze performance issues to improve application performance and quality. No need for ROOT/jailbreak, plug and play.

10 161 9 178_50003__platform=Android lan=en (1)

📦Requirements

  • Install Python 3.10 + (supports up to Python 3.14) Download
  • Install adb and configure environment variables (MagnaX's adb may not necessarily fit your computer) Download

💡 If Windows users need to test iOS, install and start iTunes. Documentation

💡 For iOS 17+ devices, you need to start the pymobiledevice3 tunnel service first:

# macOS/Linux (requires sudo)
sudo python3 -m pymobiledevice3 remote start-tunnel

# Or run as a background daemon
sudo python3 -m pymobiledevice3 remote tunneld

📥Installation

default

pip install -U magnax    (pip install magnax==version)

mirrors

pip install -i  https://mirrors.ustc.edu.cn/pypi/web/simple -U magnax

💡 If your network is unable to download through [pip install -U magnax], please try using mirrors to download, but the download of MagnaX may not be the latest version.

🚀Quickstart

default

python -m magnax

customize

python -m magnax --host=ip --port=port

🏴󠁣󠁩󠁣󠁭󠁿Python API

# magnax version : >= 1.0.0
from magnax.public.apm import AppPerformanceMonitor
from magnax.public.common import Devices

d = Devices()
processList = d.getPid(deviceId='ca6bd5a5', pkgName='com.bilibili.app.in') # for android
print(processList) # ['{pid}:{packagename}',...]

apm = AppPerformanceMonitor(pkgName='com.bilibili.app.in',platform='Android', deviceId='ca6bd5a5', surfaceview=True, 
                            noLog=False, pid=None, record=False, collect_all=False, duration=0)
# apm = AppPerformanceMonitor(pkgName='com.bilibili.app.in', platform='iOS') only supports one device
# surfaceview: False = gfxinfo (Developer - GPU rendering mode - adb shell dumpsys gfxinfo)
# noLog : False (Save test data to log file)

# ************* Collect a performance parameter ************* #
cpu = apm.collectCpu() # %
memory = apm.collectMemory() # MB
memory_detail = apm.collectMemoryDetail() # MB
network = apm.collectNetwork(wifi=True) # KB
fps = apm.collectFps() # HZ
battery = apm.collectBattery() # level:% temperature:°C current:mA voltage:mV power:w
gpu = apm.collectGpu() # %
disk = apm.collectDisk()
thermal = apm.collectThermal()
# ************* Collect all performance parameter ************* #
 
if __name__ == '__main__':
  apm = AppPerformanceMonitor(pkgName='com.bilibili.app.in',platform='Android', deviceId='ca6bd5a5', surfaceview=True, 
                              noLog=False, pid=None, record=False, collect_all=True, duration=0)
  # apm = AppPerformanceMonitor(pkgName='com.bilibili.app.in', platform='iOS',  deviceId='xxxx', noLog=False, record=False, collect_all=True, duration=0)
  #duration: running time (second)
  #record: record android screen
  apm.collectAll(report_path=None) # report_path='/test/report.html'

# in other python file
from magnax.public.apm import initPerformanceService  

initPerformanceService.stop() # stop magnax

🏴󠁣󠁩󠁣󠁭󠁿Service API

Start the service in the background

# magnax version >= 1.0.0

macOS/Linux: nohup python3 -m magnax &
Windows: start /min python3 -m magnax &

Request performance data from api

Android: http://{ip}:{port}/apm/collect?platform=Android&deviceid=ca6bd5a5&pkgname=com.bilibili.app.in&target=cpu
iOS: http://{ip}:{port}/apm/collect?platform=iOS&pkgname=com.bilibili.app.in&target=cpu

target in ['cpu','memory','memory_detail','network','fps','battery','gpu']

🔥Features

  • No ROOT/Jailbreak: No need of Root for Android devices, Jailbreak for iOS devices. Efficiently solving the test and analysis challenges in Android & iOS performance.

  • Data Integrality: We provide the data about CPU, GPU, Memory, Battery, Network,FPS, Jank, etc., which you may easy to get.

  • Beautiful Report: A beautiful and detailed report analysis, where to store, visualize, edit, manage, and download all the test cases collected with MagnaX no matter where you are or when is it.

  • Useful Monitoring Settings: Support setting alarm values, collecting duration, and accessing mobile devices on other PC machines during the monitoring process.

  • PK Model: Supports simultaneous comparative testing of two mobile devices.

    • 🌱2-devices: test the same app on two different phones.
    • 🌱2-apps: test two different apps on two phones with the same configuration.
  • Collect In Python/API: Support Python and API to collect performance data, helping users easily integrate into automated testing processes.

Develop

Dependencies

Package Purpose
flask >= 3.1.0 Web framework
loguru Logging
openpyxl >= 3.1.0 Excel report export (.xlsx)
pymobiledevice3 >= 2.0.0 iOS device control
py-ios-device >= 2.0.0 iOS performance data collection
fire CLI argument parsing
psutil System process utilities
opencv-python Screen recording

Debug

  • Remove magnax. prefix in import paths
# example
from magnax.view.apis import api
# change to
from view.apis import api
  • Run debug server
cd magnax
python debug.py

Browser

Chrome

Terminal

💕Thanks

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

magnax-1.3.1.tar.gz (12.9 MB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

magnax-1.3.1-py3-none-any.whl (13.0 MB view details)

Uploaded Python 3

File details

Details for the file magnax-1.3.1.tar.gz.

File metadata

  • Download URL: magnax-1.3.1.tar.gz
  • Upload date:
  • Size: 12.9 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.14

File hashes

Hashes for magnax-1.3.1.tar.gz
Algorithm Hash digest
SHA256 5cacdf4be90651942fbfcf6413a314de73e27254171ccaa7d28ed6a019536cf4
MD5 47b2f87492dbaed11dc51edd4e7e9191
BLAKE2b-256 c9b4e9ed1556ef9fa1b6211be629bf1b2173042f0c0eee2bb5e51d38d8d84830

See more details on using hashes here.

File details

Details for the file magnax-1.3.1-py3-none-any.whl.

File metadata

  • Download URL: magnax-1.3.1-py3-none-any.whl
  • Upload date:
  • Size: 13.0 MB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.14

File hashes

Hashes for magnax-1.3.1-py3-none-any.whl
Algorithm Hash digest
SHA256 d36d42496965fc2fa3c24c3c9780a49bf7046b0de3dd635eda3a55055058af40
MD5 df55d66ea006810f28b2f08148994d49
BLAKE2b-256 6f05a65f6f58ae38f15a3392c3d3bfc9f9663b2b08d51ef5f6feb0ac0a0fd0b9

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page