Skip to content

Instantly share code, notes, and snippets.

View kyze8439690's full-sized avatar
📱
Working

Yang Hui kyze8439690

📱
Working
View GitHub Profile
@kyze8439690
kyze8439690 / watch-fds.sh
Created April 16, 2021 09:32 — forked from jhansche/watch-fds.sh
Simple script to monitor the number open file descriptors for an Android application.
#!/bin/sh
# Usage: ./watch-fds.sh <application_id> [delay_secs = 5]
APP_ID=${1:?missing application id}
DELAY=$(( ${2:-5} ))
DEVICE_LIMIT=$(( $(adb shell ulimit -n) ))
WARN_THRESHOLD=$(( ${DEVICE_LIMIT} / 3 ))
echo "Will warn at ${WARN_THRESHOLD}"