[Laszlo-checkins] r10935 - in openlaszlo/branches/pagan-deities/WEB-INF/lps: lfc/profiler server/src/org/openlaszlo/sc

ptw@openlaszlo.org ptw at openlaszlo.org
Tue Sep 9 14:33:00 PDT 2008


Author: ptw
Date: 2008-09-09 14:32:58 -0700 (Tue, 09 Sep 2008)
New Revision: 10935

Modified:
   openlaszlo/branches/pagan-deities/WEB-INF/lps/lfc/profiler/LzProfile.lzs
   openlaszlo/branches/pagan-deities/WEB-INF/lps/server/src/org/openlaszlo/sc/JavascriptGenerator.java
Log:
Change 20080909-ptw-A by ptw at dueling-banjos.local on 2008-09-09 17:25:12 EDT
    in /Users/ptw/OpenLaszlo/pagan-deities
    for http://svn.openlaszlo.org/openlaszlo/branches/pagan-deities

Summary: Make profiling work in DHTML

Bugs Fixed:
LPP-6867 Profiler returns confusing results

Technical Reviewer: hmisky (pending)
QA Reviewer: pkang (pending)

Details:
    LzProfile: Teach the dhtml socket connection about states so that
    it doesn't flood the connection.

    JavascriptGenerator: Make sure metering has a name for each function

Tests:
    IWFM



Modified: openlaszlo/branches/pagan-deities/WEB-INF/lps/lfc/profiler/LzProfile.lzs
===================================================================
--- openlaszlo/branches/pagan-deities/WEB-INF/lps/lfc/profiler/LzProfile.lzs	2008-09-09 21:22:51 UTC (rev 10934)
+++ openlaszlo/branches/pagan-deities/WEB-INF/lps/lfc/profiler/LzProfile.lzs	2008-09-09 21:32:58 UTC (rev 10935)
@@ -109,7 +109,7 @@
       // Base ticker.  Used to reduce the range of the buffer for
       // better granularity
       this.base = (new Date).getTime();
-      this.last =  '' + ((new Date).getTime() - $lzsc$lzp.base);
+      this.last =  '' + ((new Date).getTime() - this.base);
       // Output version info when you connect
     },
 
@@ -268,7 +268,11 @@
                 this.write('\n');
             } else if ($js1) {
                 var sock = this.socket;
-                sock.onreadystatechange = function () {Profiler.processSocketChange()};
+                sock.onreadystatechange = function () {
+                  if (Profiler.processSocketChange()) {
+                    Profiler.socketState = 'open';
+                  }
+                };
                 var url = this.url.dupe();
                 url.query = 'lzt=profile&command=open';
                 sock.open('GET', url, false);
@@ -291,12 +295,15 @@
       if (sock) {
         if (sock.readyState == 4) {
           if (sock.status == 200) {
-//             if ($debug) Debug.info("Profiler.processSocketChange: %s %s", sock.statusText, sock.responseText);
+//             if ($debug) Debug.info("Profiler.processSocketChange:
+//             %s %s", sock.statusText, sock.responseText);
+            return true;
           } else {
             if ($debug) Debug.error("Profiler.processSocketChange: %s %s", sock.statusText, sock.responseText);
           }
         }
       }
+      return false;
     },
 
     // If we wanted to write the profiler data as xml
@@ -435,7 +442,26 @@
                     //fconsole.write('sent data '+seq);
                 } else if ($js1) {
                     var sock = this.socket;
-                    sock.onreadystatechange = this.processSocketChange;
+                    sock.onreadystatechange = function () {
+                      if (Profiler.processSocketChange()) {
+                        Profiler.dataState = 'idle';
+                        delete Profiler.writeBuffer;
+                        // Check for more
+                        if (! Profiler.dump()) {
+                          if (! $lzprofiler) {
+                            // Stop the backround task
+                            var dt = Profiler.dumpTask;
+                            if (dt) {
+                              clearInterval(dt);
+                              Profiler.dumpTask = null;
+                            }
+                          }
+                          if (Profiler.socketState = 'closing') {
+                            Profiler.closed();
+                          }
+                        }
+                      }
+                    };
                     var url = this.url.dupe();
                     url.query = 'lzt=profile&command=data&seqnum='+(this.seqnum++);
                     sock.open('POST', url, false);
@@ -489,7 +515,12 @@
             lv.sendAndLoad(nurl, this.returnval, "POST");
         } else if ($js1) {
             var sock = this.socket;
-            sock.onreadystatechange = this.processSocketChange;
+            sock.onreadystatechange = function () {
+              if (Profiler.processSocketChange()) {
+                Profiler.socketState = 'closed';
+                delete Profiler.socket;
+              }
+            };
             var url = this.url.dupe();
             url.query = 'lzt=profile&command=close&nchunks='+this.seqnum;
             sock.open('GET', url, false);

Modified: openlaszlo/branches/pagan-deities/WEB-INF/lps/server/src/org/openlaszlo/sc/JavascriptGenerator.java
===================================================================
--- openlaszlo/branches/pagan-deities/WEB-INF/lps/server/src/org/openlaszlo/sc/JavascriptGenerator.java	2008-09-09 21:22:51 UTC (rev 10934)
+++ openlaszlo/branches/pagan-deities/WEB-INF/lps/server/src/org/openlaszlo/sc/JavascriptGenerator.java	2008-09-09 21:32:58 UTC (rev 10935)
@@ -1128,7 +1128,7 @@
     // Tell metering to look up the name at runtime if it is not a
     // global name (this allows us to name closures more
     // mnemonically at runtime
-    String meterFunctionName = useName ? functionName : null;
+    String meterFunctionName = userFunctionName;
     Set pnames = new LinkedHashSet();
     SimpleNode[] paramIds = params.getChildren();
     for (int i = 0, len = paramIds.length; i < len; i++) {



More information about the Laszlo-checkins mailing list