3 * httpdstat.d - realtime httpd statistics. Uses DTrace.
5 * $Id: httpdstat.d 2 2007-08-01 10:01:43Z brendan $
7 * USAGE: httpdstat.d [interval [count]]
10 * count number of samples
14 * NUM Number of connections
15 * GET Number of "GET"s
16 * POST Number of "POST"s
17 * HEAD Number of "HEAD"s
18 * TRACE Number of "TRACE"s
20 * All of the statistics are printed as a value per interval (not per second).
22 * NOTE: This version does not process subsequent operations on keepalives.
24 * IDEA: Ryan Matteson (who first wrote a solution to this).
26 * COPYRIGHT: Copyright (c) 2005 Brendan Gregg.
30 * The contents of this file are subject to the terms of the
31 * Common Development and Distribution License, Version 1.0 only
32 * (the "License"). You may not use this file except in compliance
35 * You can obtain a copy of the license at Docs/cddl1.txt
36 * or http://www.opensolaris.org/os/licensing.
37 * See the License for the specific language governing permissions
38 * and limitations under the License.
42 * 20-Nov-2005 Brendan Gregg Created this.
45 #pragma D option quiet
46 #pragma D option defaultargs
48 inline int SCREEN = 21;
55 num = 0; get = 0; head = 0; post = 0; trac = 0;
58 counts = $2 ? $2 : -1;
72 /first || (secs == 0 && lines > SCREEN)/
74 printf("%-20s %6s %6s %5s %5s %5s\n", "TIME",
75 "NUM", "GET", "POST", "HEAD", "TRACE");
83 syscall::accept:return
101 this->str = (char *)copyin(self->buf, arg0);
103 get += stringof(this->str) == "GET " ? 1 : 0;
104 post += stringof(this->str) == "POST" ? 1 : 0;
105 head += stringof(this->str) == "HEAD" ? 1 : 0;
106 trac += stringof(this->str) == "TRAC" ? 1 : 0;
117 printf("%-20Y %6d %6d %5d %5d %5d\n", walltimestamp,
118 num, get, post, head, trac);
119 num = 0; get = 0; head = 0; post = 0; trac = 0;