4 Replies Latest reply: Nov 6, 2009 12:00 PM by 807559 RSS

    Dtrace tick-1s not wokring

    807559
      Is it possible that tick-1sec probe may not work?

      I have written a simple DTrace script

      #!/usr/sbin/dtrace -s

      dtrace:::BEGIN
      {
      printf("Tracing... Hit Ctrl-C to end.\n");
      }

      profile:::tick-1sec
      {
      printf(" Working\n");
      i++;
      }

      dtrace:::END
      {
      printf("%d",i);
      }

      But after starting it and running it for 10 seconds, i don't get the Working message. Also END probe prints the value of i as 0.

      Can someone help me?

      Thanks,
      Gokul.
        • 1. Re: Dtrace tick-1s not wokring
          807559
          Hi Gokul -

          I had no problems running it as written.

          Michael
          • 2. Re: Dtrace tick-1s not wokring
            807559
            Hi Michael,

            Actually i too wonder, why this simple code should not work. But how i should proceed and debug such a stuff?
            Is there a permission / some settings required? I am quite new to Dtrace and i am wondering how to proceed further..

            Thanks for your attempt at it.

            Gokul.
            • 3. Re: Dtrace tick-1s not wokring
              807559
              Hi,

              This script works perfectly for me too :
              root@mymachine:/# /tmp/dtrace.d 
              dtrace: script '/tmp/dtrace.d' matched 3 probes
              CPU     ID                    FUNCTION:NAME
                9      1                           :BEGIN Tracing... Hit Ctrl-C to end.
              
                9  62609                       :tick-1sec  Working
              
                9  62609                       :tick-1sec  Working
              ....
              What's happen exactly when trying to execute it? How do you execute it?

              Regards,
              Groucho_fr.
              • 4. Re: Dtrace tick-1s not wokring
                807559
                You should try simplifying the script. Try something like....
                $ pfexec dtrace -qn 'tick-1s { printf("tick\n") }'
                tick
                tick
                tick
                tick
                tick
                ...