I am new to Dtrace. I would like observe my system when it starts booting ( i would like to know that init did a fork and then exec to create getty and so on). I would also like to know which process did fork and exec to which function. Can anyone please provide me a dtrace script to do the above? And can anyone please guide me how to run the dtrace script at startup? Thanks in advance. -- This message posted from opensolaris.org
On Tue, May 05, 2009 at 12:14:12PM -0700, Nischal wrote:> I am new to Dtrace. > > I would like observe my system when it starts booting ( i would like > to know that init did a fork and then exec to create getty and so > on). I would also like to know which process did fork and exec to > which function. > > Can anyone please provide me a dtrace script to do the above? > And can anyone please guide me how to run the dtrace script at startup?--8<-- boot.d --8<-- #!/usr/sbin/dtrace -s // only print stuff I printf() #pragma D option quiet // Collect data until the buffer is full, then stop. This way, we will // keep all of the old data. #pragma D option bufpolicy=fill proc:::create { printf("pid %d forked pid %d\n", pid, args[0]->pr_pid); } proc:::exec-success { printf("pid %d execed \"%s\"\n", pid, curpsinfo->pr_psargs); } --8<-- boot.d --8<-- # chmod +x boot.d # ./boot.d -A dtrace: saved anonymous enabling in /kernel/drv/dtrace.conf dtrace: added forceload directives to /etc/system dtrace: run update_drv(1M) or reboot to enable changes # reboot ... blahblah console login: root password: ... # dtrace -ae -o data # cat data pid 1 execed "/sbin/init" pid 1 forked pid 4 ... pid 1231 execed "/bin/ls" # dtrace -A dtrace: cleaned up old anonymous enabling in /kernel/drv/dtrace.conf dtrace: cleaned up forceload directives in /etc/system # Look up "anonymous tracing" and the "proc provider" in the Dynamic Tracing Guide for more information. Cheers, - jonathan
On Tue, May 5, 2009 at 2:14 PM, Nischal <nischal.rao at sun.com> wrote:> I am new to Dtrace. > I would like observe my system when it starts booting ( i would like to know that init did a fork and then exec to create getty and so on). I would also like to know which process did fork and exec to which function. > Can anyone please provide me a dtrace script to do the above? > And can anyone please guide me how to run the dtrace script at startup?And then draw a pretty picture showing how long each of them ran too... http://alexeremin.blogspot.com/2009/01/boot-chart-with-help-of-dtrace-and.html http://www.milax.org/img/pybootchart.png -- Mike Gerdts http://mgerdts.blogspot.com/
Mike Gerdts writes:> http://alexeremin.blogspot.com/2009/01/boot-chart-with-help-of-dtrace-and.html > http://www.milax.org/img/pybootchart.pngWow. gdmgreeter sure sticks out there. -- James Carlson, Solaris Networking <james.d.carlson at sun.com> Sun Microsystems / 35 Network Drive 71.232W Vox +1 781 442 2084 MS UBUR02-212 / Burlington MA 01803-2757 42.496N Fax +1 781 442 1677
On Wed, May 6, 2009 at 8:57 AM, James Carlson <james.d.carlson at sun.com> wrote:> Mike Gerdts writes: >> http://alexeremin.blogspot.com/2009/01/boot-chart-with-help-of-dtrace-and.html >> http://www.milax.org/img/pybootchart.png > > Wow. ?gdmgreeter sure sticks out there.Since (nearly) the next thing that starts after gdmgreeter is Xsession, it seems to me that gdmgreeter is waiting for someone to type their username and password. It''s hard to speed that up... I would really like to see a bootchart that shows a graph in each bar showing the amount of time spent in usr, sys, and blocked on I/O. This is on my list of really cool things to write. -- Mike Gerdts http://mgerdts.blogspot.com/
Mike Gerdts writes:> On Wed, May 6, 2009 at 8:57 AM, James Carlson <james.d.carlson at sun.com> wrote: > > Mike Gerdts writes: > >> http://alexeremin.blogspot.com/2009/01/boot-chart-with-help-of-dtrace-and.html > >> http://www.milax.org/img/pybootchart.png > > > > Wow. ?gdmgreeter sure sticks out there. > > Since (nearly) the next thing that starts after gdmgreeter is > Xsession, it seems to me that gdmgreeter is waiting for someone to > type their username and password. It''s hard to speed that up...Ah, ok. I misunderstood what the bar meant.> I would really like to see a bootchart that shows a graph in each bar > showing the amount of time spent in usr, sys, and blocked on I/O. > This is on my list of really cool things to write.Yep; that''d be very interesting. -- James Carlson, Solaris Networking <james.d.carlson at sun.com> Sun Microsystems / 35 Network Drive 71.232W Vox +1 781 442 2084 MS UBUR02-212 / Burlington MA 01803-2757 42.496N Fax +1 781 442 1677
Mike Gerdts wrote:> On Wed, May 6, 2009 at 8:57 AM, James Carlson <james.d.carlson at sun.com> wrote: >> Mike Gerdts writes: >>> http://alexeremin.blogspot.com/2009/01/boot-chart-with-help-of-dtrace-and.html >>> http://www.milax.org/img/pybootchart.png >> Wow. gdmgreeter sure sticks out there. > > Since (nearly) the next thing that starts after gdmgreeter is > Xsession, it seems to me that gdmgreeter is waiting for someone to > type their username and password. It''s hard to speed that up...Right - gdmgreeter is the GUI login prompt/PAM conversation GUI. For bootchart purposes it would probably be more interesting to set up gdm autologin, so there is no wait for user interaction. -- -Alan Coopersmith- alan.coopersmith at sun.com Sun Microsystems, Inc. - X Window System Engineering