Conversation with Gemini
What tools are there to debug poor mobile phone performance? My Xiaomi Redmi Note 13 is glacially slow, even after a complete reset to defaults.
Gemini said
When a phone remains painfully slow immediately after a factory reset, the issue is almost always a low-level bottleneck: aggressive thermal throttling, hardware degradation (flash storage wear), background service loops, or OS-level configurations like swap-to-disk overhead.
Tools and methods to diagnose and trace poor performance on a Xiaomi device (HyperOS / MIUI) range from quick settings fixes to deep system profiling tools.
1. Quick Xiaomi-Specific Diagnostics & Fixes
Before diving into command-line profiling, check these common MIUI/HyperOS settings that frequently degrade performance on mid-range hardware:
Disable "Memory Extension" (Virtual RAM):
Where: Settings → Additional Settings → Memory Extension → Set to Off.
Why: Virtual RAM uses internal storage (UFS/eMMC) as swap memory. Storage write speed is orders of magnitude slower than physical RAM. On a fresh reset, this feature often turns back on by default and throttles system responsiveness.
Access the Hardware Diagnostic Menu (CIT):
How: Open the Phone dialer and type
*#*#6484#*#*(or go to Settings → About Phone → Detailed info and specs → tap Kernel version 5 times).Use: Tests onboard sensors, thermal sensors, and flash storage responsiveness.
2. On-Device Profiling Tools (Developer Options)
Enable Developer Options by going to Settings → About Phone and tapping OS Version / MIUI Version 7 times.
System Tracing (Perfetto Frontend)
Android includes a native system trace recorder built into the Developer Options.
Where: Settings → Developer Options → System Tracing.
How to use:
Turn on Trace debuggable apps and select categories (CPU frequency, scheduling, memory, graphics).
Tap Record trace.
Reproduce the stutter/lag (e.g., opening settings, scrolling) for 10–15 seconds, then stop the trace.
Analysis: Pull the
.pftracefile from/data/misc/perfetto-traces/using ADB or a file manager and open it on . It shows exact CPU frequencies, kernel context switches, and thread bottlenecks.ui.perfetto.dev
Profile HWUI Rendering
Where: Settings → Developer Options → Profile HWUI Rendering → Choose On screen as bars.
How it helps: Displays real-time rendering performance on your screen. Any bar spiking above the green line (16ms for 60Hz or 8.3ms for 120Hz) indicates a dropped frame and pinpoints whether lag is UI thread/GPU-bound.
3. Deep System Debugging via ADB (PC Connected)
Connecting your phone to a computer with adb installed provides the clearest picture of what is slowing the system down.
A. Spot CPU Hogs & Rogue Daemons
Check if a background service or corrupt system app is pinning the CPU in an infinite loop:
adb shell top -m 10 -s cpu
Look at CPU consumption percentage while the phone is idling. If process names like
system_server,surfaceflinger, or Xiaomi telemetry services stay constantly high (>20-30%), you've found the issue.
B. Inspect Memory Pressure & Throttling
adb shell dumpsys cpuinfo
adb shell dumpsys meminfo
dumpsys cpuinfoshows average load over time.dumpsys meminfoshows how physical RAM is allocated and if the system is under heavy memory pressure (zRAMthrashing).
C. Check Thermal Throttling
If a thermal sensor is failing or reporting incorrect values, the kernel will cap CPU frequencies to minimum levels to prevent damage.
adb shell dumpsys thermal
Inspect the thermal zones. If
statusis marked asMODERATE,SEVERE, orCRITICALwhile the device feels cold to the touch, a hardware sensor glitch is forcing CPU throttling.
D. Capture System Logcat Errors
A system service continuously crashing and restarting in the background causes severe UI lag:
adb logcat *:E
If error messages stream rapidly without stopping, identify the package name causing the log spam.
4. Hardware Storage Wear Checks
If a phone remains slow post-reset, degraded flash memory (high write wear causing slow I/O) is a prime candidate.
Via ADB, check flash health stats (if accessible by the kernel build):
adb shell cat /sys/class/block/mmcblk0/device/life_time
# or for UFS storage:
adb shell "cat /sys/kernel/debug/*.ufs/health" 2>/dev/null
Value outputs like
0x01indicate 0-10% life used. If it reads0x0A(90-100% life used) or higher, the onboard flash storage is worn out and throttling disk writes.
How do I install adb on a computer?
Gemini said
To install ADB (Android Debug Bridge), you don't need to install full software like Android Studio—you just need Google's official SDK Platform-Tools package.
Choose your operating system below.
Windows
Method 1: Portable Binary (No installation required)
Download the standalone SDK Platform-Tools for Windows directly from the Android Developer Website.
Extract the downloaded .zip file to an accessible location on your drive (e.g., C:\platform-tools).
Open the platform-tools folder. Hold Shift and right-click in any empty space inside the folder, then select Open PowerShell window here or Open in Terminal.
Type the following command to start the ADB daemon:
.\adb devices
(Note: The .\ prefix is required in PowerShell if the directory is not added to your system PATH).
Method 2: Package Manager (Automated System-Wide Installation)
If you use a Windows package manager, you can install ADB system-wide without manually managing ZIP archives or environment variables:
Winget:
DOSwinget install Google.PlatformToolsChocolatey:
DOSchoco install adb
macOS
Method 1: Homebrew (Recommended)
If you have Homebrew installed, open Terminal and run:
brew install android-platform-tools
This installs adb globally, allowing you to run adb devices from any terminal directory.
Method 2: Manual Zip
Download SDK Platform-Tools for Mac from Google.
Extract the
.zipto your preferred folder (e.g.,~/platform-tools).Open Terminal, navigate to the directory:
Bashcd ~/platform-toolsRun ADB using
./adb:Bash./adb devices
Linux
Package Manager (Debian / Ubuntu / Fedora / Arch)
Most distributions package ADB in their official repositories:
Debian / Ubuntu / Mint:
Bashsudo apt update sudo apt install android-tools-adb android-tools-fastbootFedora / RHEL:
Bashsudo dnf install android-toolsArch Linux / Manjaro:
Bashsudo pacman -S android-tools
Preparing Your Phone
To allow your computer to communicate with your phone via ADB:
On your Android device, go to Settings → About Phone and tap Build Number (or OS Version) 7 times to unlock Developer Options.
Go to Settings → System → Developer Options (or Additional Settings → Developer Options).
Toggle USB Debugging to On.
Connect the phone to your computer via USB.
When you run
adb devicesfor the first time, check your phone screen and tap Always allow from this computer on the RSA authorization prompt.
And FreeBSD?
Gemini said
On FreeBSD, ADB is available directly through the official ports tree and package repository via the consolidated devel/android-tools port.
1. Installation
Via Binary Package (pkg)
pkg install android-tools
Via Ports Tree
If you build from source:
cd /usr/ports/devel/android-tools/ && make install clean
(This package includes adb, fastboot, and related utilities like mkbootimg.)
2. Setting Up USB Permissions (devfs)
By default, non-root users cannot access raw USB endpoints (/dev/ugen*). To run adb without needing sudo or root:
Add your user to the
operatorgroup:Bashpw groupmod operator -m your_usernameConfigure
/etc/devfs.rulesto allow access: If/etc/devfs.rulesdoesn't exist, create it and add a rule for USB access:Ini, TOML[localrules=10] add path 'ugen*' mode 0660 group operator add path 'usb/*' mode 0660 group operator add path 'usbctl' mode 0660 group operatorEnable the ruleset in
/etc/rc.conf:Ini, TOMLdevfs_system_ruleset="localrules"Restart
devfsto apply:Bashservice devfs restart
3. Running ADB
Once installed and devfs permissions are set, plug in the phone with USB debugging enabled on the device, then start the daemon:
adb devices
If you encounter permissions issues, restarting the daemon with elevated privileges will confirm if it's a devfs ownership issue:
adb kill-server
sudo adb devices
.jpg)
Gemini is AI and can make mistakes.
