/*
* weblatency.d - website latency statistics.
* Written using DTrace (Solaris 10 3/05).
*
* $Id: weblatency.d 3 2007-08-01 10:50:08Z brendan $
*
* USAGE: weblatency.d # hit Ctrl-C to end sample
*
* See the code below for the "BROWSER" variable, which sets the browser
* to trace (currently set to "mozilla-bin").
*
* This is written as an experimental tool, and may not work at all with
* your browser.
*
* FIELDS:
* HOST Hostname from URL
* NUM Number of GETs
* AVGTIME(ms) Average time for response, ms
* MAXTIME(ms) Maximum time for response, ms
*
* NOTE:
*
* The latency measured here is from the browser sending the GET
* request to when the browser begins to recieve the response. It
* is an overall response time for the client, and encompasses
* connection speed delays, DNS lookups, proxy delays, and web server
* response time.
*
* IDEA: Bryan Cantrill (who wrote an elegant version for Sol 10 update 1)
*
* COPYRIGHT: Copyright (c) 2005, 2006 Brendan Gregg.
*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License, Version 1.0 only
* (the "License"). You may not use this file except in compliance
* with the License.
*
* See the License for the specific language governing permissions
* and limitations under the License.
*
* CDDL HEADER END
*
* ToDo:
* Check write fd for socket, not file.
*
* 30-Nov-2005 Brendan Gregg Created this.
* 20-Apr-2006 " " Last update.
*/
/* browser's execname */
/* maximum expected hostname length + "GET http://" */
inline int MAX_REQ = 64;
{
printf("Tracing... Hit Ctrl-C to end.\n");
}
/*
* Trace brower request
*
* This is achieved by matching writes for the browser's execname that
* start with "GET", and then timing from the return of the write to
* the return of the next read in the same thread. Various stateful flags
* are used: self->fd, self->read.
*
* For performance reasons, I'd like to only process writes that follow a
* connect(), however this approach fails to process keepalives.
*/
{
}
{
}
{
/* fetch browser request */
/*
* This unrolled loop strips down a URL to it's hostname.
* We ought to use strtok(), but it's not available on Sol 10 3/05,
* so instead I used dirname(). It's not pretty - it's done so that
* this works on all Sol 10 versions.
*/
/* start the timer */
}
/* this one wasn't a GET */
{
}
{
}
/*
* Record host details
*/
{
/* fetch details */
/* save details */
/* clear vars */
}
/*
* Output report
*/
{
}