598e0069162f17810f9672d338b317d1914d7d4e hiram Wed Aug 25 15:34:31 2010 -0700 add measureTiming CGI option to measure custom track loading time diff --git src/hg/hgCustom/hgCustom.c src/hg/hgCustom/hgCustom.c index 7fb2853..ddbd1db 100644 --- src/hg/hgCustom/hgCustom.c +++ src/hg/hgCustom/hgCustom.c @@ -19,6 +19,8 @@ #include "udc.h" #endif//def USE_BAM && KNETFILE_HOOKS +static long loadTime = 0; + static char const rcsid[] = "$Id: hgCustom.c,v 1.142 2010/05/28 23:04:56 kuhn Exp $"; void usage() @@ -31,6 +33,9 @@ ); } +/* DON'T EDIT THIS -- use CGI param "&measureTiming=." */ +static boolean measureTiming = FALSE; + #define TEXT_ENTRY_ROWS 7 #define TEXT_ENTRY_COLS 73 #define CONFIG_ENTRY_ROWS 3 @@ -673,6 +678,8 @@ printf("<B>genome:</B> %s <B>assembly:</B> %s [%s]\n", organism, hFreezeDate(database), database); +if (measureTiming && (loadTime > 0)) + printf("\n<BR>load time: %ld ms<BR>\n", loadTime); /* place for warning messages to appear */ if (isNotEmpty(warn)) { @@ -1001,7 +1008,10 @@ boolean ctUpdated = FALSE; char *initialDb = NULL; +long thisTime = clock1000(); + cart = theCart; +measureTiming = isNotEmpty(cartOptionalString(cart, "measureTiming")); initialDb = cloneString(cartString(cart, "db")); getDbAndGenome(cart, &database, &organism, oldVars); @@ -1205,6 +1215,11 @@ } warn = dyStringCannibalize(&dsWarn); + if (measureTiming) + { + long lastTime = clock1000(); + loadTime = lastTime - thisTime; + } if (!initialDb || ctList || cartVarExists(cart, hgCtDoDelete)) doManageCustom(warn); else if (ctParseError)