Skip to content

Instantly share code, notes, and snippets.

@prologic
Created April 28, 2015 00:39
Show Gist options
  • Save prologic/9d82342ebb48f5d335a3 to your computer and use it in GitHub Desktop.
Save prologic/9d82342ebb48f5d335a3 to your computer and use it in GitHub Desktop.
A crude way to watch file descriptor leakage(s)
#!/usr/bin/env python
import matplotlib as mpl
mpl.use('Agg')
import matplotlib.pyplot as plt
fds = [int(x.strip()) for x in open("fds.log", "r")]
plt.plot(fds)
plt.savefig("fds.png")
#!/bin/bash
LOGFILE=/root/fds.log
if [ ! -f $LOGFILE ]; then
touch $LOGFILE
fi
TMPID=$(pgrep -f task_maste)
while true; do
echo $(lsof -p $TMPID | wc -l) >> $LOGFILE
sleep 60
done
@prologic
Copy link
Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment