update scripts
authorDan White <dan@whiteaudio.com>
Tue, 20 Jan 2015 17:42:44 +0000 (11:42 -0600)
committerDan White <dan@whiteaudio.com>
Tue, 20 Jan 2015 17:42:44 +0000 (11:42 -0600)
TimeSampleHistogram
cleanup-timesamples
timeSampler

index 244b841820197d25c44e5da4a4fcfba1a0e08fc4..fe42c3000dcceaa8a387ffda67a4fb5e37bc15ce 100755 (executable)
@@ -144,7 +144,9 @@ else:
 #
 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)
index e31b03d665055741cbe09b9df231086ba2dd80c2..347832232e51d18708d85fe16cdb25b656010d62 100755 (executable)
@@ -2,26 +2,33 @@
 
 # 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
+
+
index 2be7fe344678733572188d9608d8a7eafb4f1e0e..53afc602bfafbbd87473fb159ac28e590f36c6f2 100755 (executable)
@@ -15,7 +15,7 @@ BEEP="aplay /home/dan/tmp/pop.wav"
 MINUTES=6 #to give 10/hour
 #MAXJOBS=$((1*60/$MINUTES))
 #MAXJOBS=8
-MAXJOBS=17
+MAXJOBS=21
 MAXJOBS=$(($MAXJOBS-1))
 
 LOGFILE="$HOME/.timeSampler.$HOSTNAME"