Hi All,
 
We are extending classes in an initail effort to instrument DNS, connect, 
response(first buffer read), and
download.
The DNS and connect looks pretty good.
 
Where are the bits actually being retrieved over the wire?
Overriding HttpMethodBase. byte[] getResponseBody() and adding response and download 
times returns reasonable
looking response times, but almost all the download duration times are 0. Here is the 
current code. It is
derived from GetMethod.java
 
    public byte[] getResponseBody() {
        if (this.responseBody == null) {
            try {
                boolean firstReadDone = false;
                InputStream instream = getResponseBodyAsStream();
                if (instream != null) {
                    LOG.debug("Buffering response body");
                    ByteArrayOutputStream outstream = new ByteArrayOutputStream();
                    byte[] buffer = new byte[4096];
                    int len;
                    while ((len = instream.read(buffer)) > 0) {
                        outstream.write(buffer, 0, len);
                        if ( !firstReadDone ) {
                            responseEnd = System.currentTimeMillis();
                        }
                        System.out.println("ApacheGetMethod.getResponseBody() path: " 
+ getPath() + " bytes
read: " + len );
                        firstReadDone = true;
                    }
                    outstream.close();
                    setResponseStream(null);
                    this.responseBody = outstream.toByteArray();
                }
            } catch (IOException e) {
                LOG.error("I/O failure reading response body", e);
                this.responseBody = null;
            }
            long downloadEnd = System.currentTimeMillis();
            downloadDuration = downloadEnd - responseEnd;
            System.out.println("ApacheGetMethod.getResponseBody() path: " + getPath() 
+ " responseEnd: " +
responseEnd + " downloadEnd: " + downloadEnd + " downloadDuration: " + 
downloadDuration );
        }
        return this.responseBody;
    }
 
Thanks for any ideas or information,
 
Steve
 
Steve Johnson
Software Engineer
Mercury Interactive
720 564 - 6532
USA, Canada and the Americas 
720 564-6620
Hours: M-F 08:00-17:00 MST (Mountain Standard Time) 
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 <http://www.mercuryinteractive.com> http://www.mercuryinteractive.com
Looking for Answers to your SiteScope or SiteSeer questions?        
<http://support.mercuryinteractive.com>
http://support.mercuryinteractive.com
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 
 
 

Reply via email to