Angelo's Soapbox |
|
Wednesday Jun 17, 2009
Diving into the Depths of Drupal with DTrace
I recently presented DTrace at Sun's CommunityONE event. My presentation was focused on observing drupal using DTrace. You can see a replay of the presentation here. You can get the presentation here as well.
#!/usr/sbin/dtrace -qs
BEGIN
{
total=mysqlcnt=httpcnt=phpcnt=javacnt=ffxcnt=othercnt=0;
printf("%10s %10s %10s %10s %10s %10s\n","% MYSQL","% APACHE","% FIREFOX","% PHP","% Java","% OTHER");
}
php*:::request-startup
{
inphp[pid,tid]=1;
}
php*:::request-shutdown
{
inphp[pid,tid]=0;
}
profile-1001
{
total++;
(execname=="mysqld")?mysqlcnt++:\
(execname=="httpd")?(inphp[pid,tid]==1?phpcnt++:httpcnt++):\
(execname=="java")?javacnt++:\
(execname=="firefox-bin")?ffxcnt++:othercnt++;
}
tick-30s
{
printf("%10s %10s %10s %10s %10s %10s\n","% MYSQL","% APACHE","% FIREFOX","% PHP","% Java","% OTHER");
}
tick-2s
{
printf("%10d %10d %10d %10d %10d %10d\n",mysqlcnt*100/total,\
httpcnt*100/total,ffxcnt*100/total, phpcnt*100/total,\
javacnt*100/total,othercnt*100/total);
total=mysqlcnt=httpcnt=phpcnt=ffxcnt=javacnt=othercnt=0;
}
I will post other scripts soon. I plan to twitter these scripts as well. Follow me on twitter
Posted at 09:30AM Jun 17, 2009 by angelo in DTrace | Comments[1] |
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||