Nicer about locks, I hope.
[goodfet] / client / GoodFETGlitch.py
index 2e0b2b4..637b2d1 100644 (file)
@@ -83,12 +83,15 @@ class GoodFETGlitch(GoodFET):
         self.db.execute("drop table if exists glitchrange;");
         self.db.execute("create table glitchrange(time integer primary key asc,max,min);");
         self.db.execute("insert into glitchrange(time,max,min) select distinct time, 0, 0 from glitches;");
+        self.db.commit();
         print "Maximums...";
         sys.stdout.flush();
         self.db.execute("update glitchrange set max=(select max(vcc) from glitches where glitches.time=glitchrange.time and count=0);");
+        self.db.commit();
         print "Minimums...";
         sys.stdout.flush();
         self.db.execute("update glitchrange set min=(select min(vcc) from glitches where glitches.time=glitchrange.time and count>0);");
+        self.db.commit();
         print "Ranges calculated.";
     def graphx11(self):
         try:
@@ -135,8 +138,15 @@ class GoodFETGlitch(GoodFET):
         #self.crunch();
         count=0.0;
         total=1.0*len(times);
-        for t in times:
-            voltages=self.glitchvoltages(t);
+        
+        c=self.db.cursor();
+        c.execute("select time,min,max from glitchrange where max-min>0;");
+        rows=c.fetchall();
+        for r in rows:
+            t=r[0];
+            min=r[1];
+            max=r[2];
+            voltages=range(min,max,1);
             count=count+1.0;
             print "%02.02f Exploring %04i points in t=%04i." % (count/total,len(voltages),t);
             sys.stdout.flush();