8a14bfc57fd743b14842c8db206876779e3bc21b
larrym
Wed Aug 10 13:43:51 2011 -0700
move measureTiming output into span's so it can be manipulated on client side; add experimental dead code for returning image via URL (redmine #4888)
diff --git src/hg/hgTracks/hgTracks.c src/hg/hgTracks/hgTracks.c
index 53043c4..72a23e5 100644
--- src/hg/hgTracks/hgTracks.c
+++ src/hg/hgTracks/hgTracks.c
@@ -2503,30 +2503,54 @@
jsonHashAddBoolean(jsonForClient, "inPlaceUpdate", IN_PLACE_UPDATE);
if(rulerClickHeight)
{
jsonHashAddNumber(jsonForClient, "rulerClickHeight", rulerClickHeight);
}
if(newWinWidth)
{
jsonHashAddNumber(jsonForClient, "newWinWidth", newWinWidth);
}
/* Save out picture and tell html file about it. */
if(hvgSide != hvg)
hvGfxClose(&hvgSide);
hvGfxClose(&hvg);
+
+#ifdef SUPPORT_CONTENT_TYPE
+// following is (currently dead) experimental code to bypass hgml and return png's directly - see redmine 4888
+if(sameString(cartUsualString(cart, "hgt.contentType", "html"), "png"))
+ {
+ char buf[4096];
+ FILE *fd = fopen(gifTn.forCgi, "r");
+ if(fd == NULL)
+ // fail some other way (e.g. HTTP 500)?
+ errAbort("Couldn't open png for reading");
+ while(TRUE)
+ {
+ size_t n = fread(buf, 1, sizeof(buf), fd);
+ if(n)
+ fwrite(buf, 1, n, stdout);
+ else
+ break;
+ }
+ fclose(fd);
+ unlink(gifTn.forCgi);
+ return;
+ }
+#endif
+
if(theImgBox)
{
imageBoxDraw(theImgBox);
#ifdef IMAGEv2_DRAG_SCROLL
// If a portal was established, then set the global dimensions back to the portal size
if(imgBoxPortalDimensions(theImgBox,NULL,NULL,NULL,NULL,&winStart,&winEnd,&(tl.picWidth),NULL))
{
pixWidth = tl.picWidth;
winBaseCount = winEnd - winStart;
insideWidth = tl.picWidth-gfxBorder-insideX;
}
#endif//def IMAGEv2_DRAG_SCROLL
imgBoxFree(&theImgBox);
}
else
@@ -4565,30 +4589,62 @@
char temp[256];
safef(temp, sizeof temp, "Timeout %d milliseconds exceeded processing %s", maxTimeInMilliseconds, pfd->track->track);
pfd->track->networkErrMsg = cloneString(temp);
++errCount;
}
for (pfd = pfdDone; pfd; pfd = pfd->next)
{
// some done tracks may have errors
if (pfd->track->networkErrMsg)
++errCount;
}
pthread_mutex_unlock( &pfdMutex );
return errCount;
}
+static void printTrackTiming()
+{
+hPrintf("track, load time, draw time, total
\n");
+struct track *track;
+for (track = trackList; track != NULL; track = track->next)
+ {
+ if (track->visibility == tvHide)
+ continue;
+ if (trackIsCompositeWithSubtracks(track)) //TODO: Change when tracks->subtracks are always set for composite
+ {
+ struct track *subtrack;
+ for (subtrack = track->subtracks; subtrack != NULL;
+ subtrack = subtrack->next)
+ if (isSubtrackVisible(subtrack))
+ hPrintf("%s, %d, %d, %d
\n", subtrack->shortLabel,
+ subtrack->loadTime, subtrack->drawTime,
+ subtrack->loadTime + subtrack->drawTime);
+ }
+ else
+ {
+ hPrintf("%s, %d, %d, %d
\n",
+ track->shortLabel, track->loadTime, track->drawTime,
+ track->loadTime + track->drawTime);
+ if (startsWith("wigMaf", track->tdb->type))
+ if (track->subtracks)
+ if (track->subtracks->loadTime)
+ hPrintf(" %s wiggle, load %d
\n",
+ track->shortLabel, track->subtracks->loadTime);
+ }
+ }
+hPrintf("\n");
+}
void doTrackForm(char *psOutput, struct tempName *ideoTn)
/* Make the tracks display form with the zoom/scroll buttons and the active
* image. If the ideoTn parameter is not NULL, it is filled in if the
* ideogram is created. */
{
struct group *group;
struct track *track;
char *freezeName = NULL;
boolean hideAll = cgiVarExists("hgt.hideAll");
boolean defaultTracks = cgiVarExists("hgt.reset");
boolean showedRuler = FALSE;
boolean showTrackControls = cartUsualBoolean(cart, "trackControlsOnMain", TRUE);
long thisTime = 0, lastTime = 0;
@@ -4606,31 +4662,31 @@
withNextItemArrows = FALSE;
withNextExonArrows = FALSE;
hgFindMatches = NULL;
}
/* Tell browser where to go when they click on image. */
hPrintf("