7c2225f25a445de7e6619f91f83b18a34f885cc1
hiram
  Fri Jan 4 10:40:50 2013 -0800
adding measureTiming outputs for png trash file write and cart write close at end plus a single stderr output for overall total time to apache error_log
diff --git src/hg/hgTracks/hgTracks.c src/hg/hgTracks/hgTracks.c
index 687b798..d18fc54 100644
--- src/hg/hgTracks/hgTracks.c
+++ src/hg/hgTracks/hgTracks.c
@@ -2115,30 +2115,32 @@
         }
     }
 
 imagePixelHeight = pixHeight;
 if (psOutput)
     {
     hvg = hvGfxOpenPostScript(pixWidth, pixHeight, psOutput);
     hvgSide = hvg; // Always only one image
     }
 else
     {
     boolean transparentImage = FALSE;
     if (theImgBox!=NULL)
         transparentImage = TRUE;   // transparent because BG (blue ruler lines) is separate image
 
+    if (measureTiming)
+        measureTime("Time at start of obtaining trash hgt png image file");
     trashDirFile(&gifTn, "hgt", "hgt", ".png");
     hvg = hvGfxOpenPng(pixWidth, pixHeight, gifTn.forCgi, transparentImage);
 
     if (theImgBox)
         {
         // Adds one single image for all tracks (COULD: build the track by track images)
         theOneImg = imgBoxImageAdd(theImgBox,gifTn.forHtml,NULL,pixWidth, pixHeight,FALSE);
         theSideImg = theOneImg; // Unlkess this is overwritten below, there is a single image
         }
     hvgSide = hvg; // Unlkess this is overwritten below, there is a single image
 
     if (theImgBox && theImgBox->showPortal && withLeftLabels)
         {
         // TODO: It would be great to make the two images smaller,
         //       but keeping both the same full size for now
@@ -2571,30 +2573,32 @@
 /* Finish map. */
 hPrintf("</MAP>\n");
 
 // turn off inPlaceUpdate when rows in imgTbl can arbitrarily reappear and disappear (see redmine #7306 and #6944)
 jsonObjectAdd(jsonForClient, "inPlaceUpdate", newJsonBoolean(withLeftLabels && withCenterLabels));
 jsonObjectAdd(jsonForClient, "rulerClickHeight", newJsonNumber(rulerClickHeight));
 if(newWinWidth)
     {
     jsonObjectAdd(jsonForClient, "newWinWidth", newJsonNumber(newWinWidth));
     }
 
 /* Save out picture and tell html file about it. */
 if (hvgSide != hvg)
     hvGfxClose(&hvgSide);
 hvGfxClose(&hvg);
+if (measureTiming)
+    measureTime("Time completed writing trash hgt png image file");
 
 #ifdef SUPPORT_CONTENT_TYPE
 char *type = cartUsualString(cart, "hgt.contentType", "html");
 if(sameString(type, "jsonp"))
     {
     struct jsonElement *json = newJsonObject(newHash(8));
 
     printf("Content-Type: application/json\n\n");
     jsonObjectAdd(json, "track", newJsonString(cartString(cart, "hgt.trackNameFilter")));
     jsonObjectAdd(json, "height", newJsonNumber(pixHeight));
     jsonObjectAdd(json, "width", newJsonNumber(pixWidth));
     jsonObjectAdd(json, "img", newJsonString(gifTn.forHtml));
     printf("%s(", cartString(cart, "jsonp"));
     hPrintEnable();
     jsonPrint((struct jsonElement *) json, NULL, 0);
@@ -5697,16 +5701,18 @@
     for (grp = grps; grp != NULL; grp = grp->next)
         if (startsWith("encode", grp->name))
             collapseGroup(grp->name, FALSE);
     configPageSetTrackVis(-2);
     }
 else
     {
     tracksDisplay();
     }
 
 jsonObjectAdd(jsonForClient, "measureTiming", newJsonBoolean(measureTiming));
 hPrintf("<script type='text/javascript'>\n");
 jsonPrint((struct jsonElement *) jsonForClient, "hgTracks", 0);
 hPrintf("</script>\n");
 
+if (measureTiming)
+    measureTime("Time at end of doMiddle, next up cart write");
 }