code: public void writePerfStats() {
  		if (hasWritten) {
  			return;
  		}
  
  		// call timeEnd only if it's not already called, so as
  		// not to change its value. 
  		long elapsed = PerfStats.getTotal(perfStat);
  		if (elapsed <= 0) {
  			elapsed = PerfStats.timeEnd(perfStat);
  		}
  
  		if (perfStatsHeader != null) {
  			httpResponse.setHeader(perfStatsHeader, PerfStats.getAllStats(outputFormat));
  		}
  
  		if (perfCookie && requestURI != null) {
  			Cookie cookie = new Cookie("wb_total_perf", String.valueOf(elapsed));
  			cookie.setMaxAge(expireTimeout);
  			//cookie.setDomain(domainName);
  			cookie.setPath(requestURI);
  			try {
  				httpResponse.addCookie(cookie);
  			} catch (IllegalArgumentException ex) {
  				Logger logger = Logger.getLogger(getClass().getName());
  				logger.warning("addCookie failed for " + cookie + " (path=\"" +
  						requestURI + "\"): " + ex.getMessage());
  			}
  		}
  
  		hasWritten = true;
  	}
docs: Write performance metrics to HTTP header field and Cookie.
  You don't need to call this method explicitly. It is called
  implicitly by calls to {@link #sendError(int)}, {@link #sendRedirect(String)},
  {@link #getWriter()} or {@link #getOutputStream()}.
  2014-11-17 Now it doesn't call {@code timeEnd} for
  {@code perfStat}. Be sure to call {@code endNow()} explicitly.