Add shark instrumentation. Secret, for now
authorBenjamin Smedberg <benjamin@smedbergs.us>
Mon, 15 Dec 2008 14:56:16 -0500
changeset 16 fd877bb1e6be
parent 15 c18b21740d39
child 17 f968472d57b8
push id5
push userbsmedberg@mozilla.com
push date2008-12-15 20:46 +0000
Add shark instrumentation. Secret, for now
wordmap.js
--- a/wordmap.js
+++ b/wordmap.js
@@ -1,12 +1,12 @@
 const kWidth = 800;
 const kHeight = 800;
-const kParanoid = false;
 
+var gShark = false;
 var gFont;
 
 function setFont()
 {
   gFont = $('font').value;
 }
 setFont();
 
@@ -367,16 +367,21 @@ function draw(text)
   /* comment out testing code */
 
   // simpletest(cx, imgdata);
 
   let wdata, wshadow, word, size, vertical, x, y;
 
   let totalcount = Math.min(words.length, 200);
 
+  if (gShark) {
+    connectShark();
+    startShark();
+  }
+
   /*
    * place the first word in a position randomly
    */
   [word, size] = words[0];
   setStatus("Placing word '" + word + "': 1/" + totalcount);
   yield;
 
   vertical = Math.random() < kVerticalRatio;
@@ -405,16 +410,21 @@ function draw(text)
         yield;
       }
     }
 
     usercx.putImageData(imgdata, 0, 0);
   }
 
   setStatus('Done!');
+
+  if (gShark) {
+    stopShark();
+    disconnectShark();
+  }
 }
 
 function placeWord(imgdata, wdata)
 {
   let x = normalInt(0, kWidth - wdata.width, 1);
   let y = normalInt(0, kHeight - wdata.height, 1);
   for (let t = 1; t < 20; ++t) {
     let x2 = normalInt(0, kWidth - wdata.width, t);