9 Replies Latest reply: May 4, 2010 3:54 AM by 807559 RSS

    Dtrace , How I can monitor the process startup.

    807559
      Hello all,


      How I can monitor by dtrace the process startup ?


      Regards!
      Valdemar
        • 1. Re: Dtrace , How I can monitor the process startup.
          807559
          For a simple report of new process starts:

          # dtrace -qn 'proc:::exec-success { printf("%s started at %Y\n", execname, walltimestamp);}'
          • 2. Re: Dtrace , How I can monitor the process startup.
            807559
            thanks Michael,


            But I do need samething equivalent to dtruss to monitor a specific process during the startup.


            Regards!
            Valdemar
            • 3. Re: Dtrace , How I can monitor the process startup.
              807559
              What is it you need that dtruss doesn't do?

              dtruss -n <progname> will monitor processes that are started after the fact.
              • 4. Re: Dtrace , How I can monitor the process startup.
                807559
                must be like:

                http://www.solarisinternals.com/wiki/index.php/DTrace_Topics_Features


                [edit] anonymous tracing
                Anonymous tracing is the ability to trace during boot, before processes have began executing.

                For example, here we use dtrace -A to initiate a trace on nge events during boot, which is our network driver,

                # dtrace -A -n 'fbt:nge::entry { trace(timestamp); }'
                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
                #
                # init 6
                [...time passes...]


                After the system reboots, dtrace -a is used to retrieve the anonymous trace. Here it is post sorted as we are on a multi-CPU server,

                # dtrace -a > /tmp/out
                # sort -n +3 /tmp/out

                CPU ID FUNCTION:NAME
                1 66351 nge_attach:entry 50340150685
                1 66321 nge_get_props:entry 50340920147
                1 66319 nge_check_desc_prop:entry 50340930003
                1 66501 nge_chip_cfg_init:entry 50340944350
                1 66523 nge_alloc_bufs:entry 50340969182
                1 66473 nge_alloc_dma_mem:entry 50340970449
                1 66473 nge_alloc_dma_mem:entry 50340998798
                1 66473 nge_alloc_dma_mem:entry 50341011886
                [...]
                • 5. Re: Dtrace , How I can monitor the process startup.
                  807559
                  So the process you want to watch is the boot process, not a specific application? If that's the case, is there something specific you'd like to observe. I sure hope you don't want to see every system call that's been made in preparing the system...
                  • 6. Re: Dtrace , How I can monitor the process startup.
                    807559
                    Michael

                    thanks! it is working perfectlly :



                    # ./dtruss -n soapAsyncServer -l
                    PID/LWP SYSCALL(args) = return
                    27867/1: mmap(0x0, 0x1000, 0x7) = -12648448 0
                    27867/1: resolvepath("/usr/lib/amd64/ld.so.1\0", 0xFFFFFD7FFFDFE900, 0x3FF) = 18 0
                    27867/1: resolvepath("/unisphere/srx3000/UNSPsubp/soapAsyncServer\0", 0xFFFFFD7FFFDFE900, 0x3FF) = 43 0
                    27867/1: stat("/unisphere/srx3000/UNSPsubp/soapAsyncServer\0", 0xFFFFFD7FFFDFEE70, 0xFFFFFD7FFF3FCB58) = 0 0
                    27867/1: open("/var/ld/64/ld.config\0", 0x0, 0x0) = 4 0
                    27867/1: fstat(0x4, 0xFFFFFD7FFFDFEC80, 0x3) = 0 0
                    27867/1: mmap(0x0, 0xC0, 0x1) = -12910592 0
                    27867/1: close(0x4) = 0 0
                    27867/1: stat("/lib/secure/64/libgcc_s.so.1\0", 0xFFFFFD7FFFDFE850, 0x0) = 0 0
                    27867/1: resolvepath("/lib/secure/64/libgcc_s.so.1\0", 0xFFFFFD7FFFDFE450, 0x3FF) = 31 0
                    27867/1: open("/lib/secure/64/libgcc_s.so.1\0", 0x0, 0x0) = 4 0
                    27867/1: mmap(0x10000, 0x8000, 0x5) = -12976128 0
                    27867/1: mmap(0x0, 0x1000, 0x7) = -13041664 0
                    27867/1: mmap(0x10000, 0x1D000, 0x0) = -13172736 0
                    • 7. Re: Dtrace , How I can monitor the process startup.
                      807559
                      Hi,

                      I want to see all the system calls the process invokes during it's life time. I thought of using dtruss for this. From the source code i can make out that it is a shell script. Can i run the dtruss by just copying the source code from http://www.brendangregg.com/DTrace/dtruss without installing the dtrace

                      or do i need to install dtrace to run dtruss ? if so where is the link to download dtrace for solaris.

                      Rgds,
                      Su
                      • 8. Re: Dtrace , How I can monitor the process startup.
                        807559
                        Hello Su -

                        DTrace is only available for Solaris 10 and is installed by default. Check for /usr/sbin/dtrace on your system. If that's in place, you can use any DTrace script with it.
                        • 9. Re: Dtrace , How I can monitor the process startup.
                          807559
                          Hello Michael,

                          Thanks for the information. I upgraded to 5.10 and able to use dtrace/dtruss.

                          Best Regards,
                          Su