Skip to content

Instantly share code, notes, and snippets.

Avatar
📱
Working

Yang Hui kyze8439690

📱
Working
View GitHub Profile
@kyze8439690
kyze8439690 / watch-fds.sh
Created Apr 16, 2021 — forked from jhansche/watch-fds.sh
Simple script to monitor the number open file descriptors for an Android application.
View watch-fds.sh
#!/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}"