BTW, I replaced "string" with "Xstring" and it works. If I could avoid
touching Apache's files, that would be nice. But I can live with this.
Thanks for the help everybody!
I want to share this with anyone who will come looking for this later:
Copy the Apache header files to a work directory:
# cp -R /opt/apache/include /export/home/amitchel
My command line:
dtrace -32 -C -I /export/home/amitchel/include -x cpppath=/usr/sfw/bin/cpp -Xs
-s watchApacheRequests.d -p 843
My script:
#!/usr/sbin/dtrace
#define __builtin_va_list long
#define __attribute__(x)
#include <httpd.h>
pid$target:a.out:ap_process_request:entry
{
self->ts = timestamp;
self->r = (request_rec*) copyin(arg0, sizeof(request_rec));
self->uri = copyinstr((uintptr_t) self->r->uri);
}
pid$target:a.out:ap_process_request:return
/self->ts/
{
@request_uris[self->uri] = quantize((timestamp - self->ts) / 1000000);
self->ts = 0;
self->uri = "err";
}
tick-5s
{
printa(@request_uris);
}
You'll get some errors like this because of the 'string' reserved keyword:
cc1: warning: /dev/fd/6 is shorter than expected
dtrace: failed to compile script watchApacheRequests.d:
"/export/home/amitchel/include/ap_regex.h", line 117: syntax error near "string"
Edit the file, replace 'string' with 'Xstring' and try again. I had to edit
these files:
/export/home/amitchel/include/ap_regex.h
/export/home/amitchel/include/httpd.h
And here's the script output:
0 49008 :tick-5s
/hello
value ------------- Distribution ------------- count
1 | 0
2 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1
4 | 0
/page1
value ------------- Distribution ------------- count
1 | 0
2 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1
4 | 0
/pageTwo
value ------------- Distribution ------------- count
1 | 0
2 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1
4 | 0
--
This message posted from opensolaris.org
_______________________________________________
dtrace-discuss mailing list
[email protected]