#
files = [f for f in os.listdir(os.environ['HOME'])
if f.startswith('.timeSampler') and not
- (f.endswith('.gz') or f.endswith('.all'))]
+ (f.endswith('.gz')
+ or f.endswith('.all')
+ or f.endswith('.tmp'))]
hist = defaultdict(lambda: 0)
histHier = defaultdict(lambda: 0)
# cleanup data from timeSampler,
# removes null entries and sorts by time
-
# no argument edits before cleanup
-# -E edits after cleanup
-TMPFILE=$(tempfile)
-
-if [ "$1" = "" ]; then
- orig="$HOME/.timeSampler.$HOSTNAME"
- sort -u $orig > $TMPFILE
- cp $TMPFILE $orig
- vim $orig
+# -s sorts before editing
+# -c sorts and cleans "null" entries after editing
+
+SAMPLES="$HOME/.timeSampler.$HOSTNAME"
+#TMPFILE=$(tempfile)
+TMPFILE="$SAMPLES.tmp"
+
+
+if [ "$1" = "-s" ]; then
+ echo "Sorting entries first."
+ sleep 2
+ sort -u $SAMPLES > $TMPFILE
+ cp $TMPFILE $SAMPLES
shift
fi
-for f in $(ls -1 $HOME/.timeSampler.*); do
- grep -v "null$" $f | sort -u > $TMPFILE
- cp $TMPFILE $f
-done
-rm -f $TMPFILE
+vim $SAMPLES
-if [ "$1" = "-E" ]; then
- vim $HOME/.timeSampler.$HOSTNAME
+
+if [ "$1" = "-c" ]; then
+ echo "Cleaning and sorting all timeSamples."
+ for f in $(ls -1 $HOME/.timeSampler.*); do
+ grep -v "null$" $f | sort -u > $f.tmp
+ cp $f.tmp $f
+ done
fi
+
+
MINUTES=6 #to give 10/hour
#MAXJOBS=$((1*60/$MINUTES))
#MAXJOBS=8
-MAXJOBS=17
+MAXJOBS=21
MAXJOBS=$(($MAXJOBS-1))
LOGFILE="$HOME/.timeSampler.$HOSTNAME"