Dynamically Tracing
     KDE
     Manish Chakravarty
     ThoughtWorks Studios




                            1
Agenda

• Learn about DTrace
• Learn what and where to Trace
• Trace!


                                  2
I. What is DTrace?


 While I go through the slides, please start copying the VM!

                                       ...
DTrace is..

• a comprehensive Dynamic Tracing
  framework created by Sun Microsystems
  for troubleshooting kernel and ap...
Excuse me?



             5
• Dtrace enables us to “look into” the
  internals of a running production application
  and allows us to instrument it

•...
So how does DTrace
      work?


                     7
• Dtrace allows you to dynamically modify
  the operating system kernel and user
  processes to record additional data tha...
• Dtrace probes come from a set of kernel
  modules called providers, each of which
  performs a particular type of
  inst...
Provider:Module:Function:Name




                                10
Provider
The name of the DTrace provider that is publishing this
                      probe




                         ...
Module
   If this probe corresponds to a specific program
location, the name of the module which the probe is
             ...
Function
    If this probe corresponds to a specific program
location, the name of the program function in which the
      ...
Name
The final component of the probe name is a name that
 gives you some idea of the probe’s semantic meaning
            ...
Thus:
Provider:Module:Function:Name



                                15
DTrace Architecture
                      16
Let’s start Tracing!



                       17
manish@belenix-KDE4:~/WorkOut/
DTraceTutorial$ pfexec dtrace -n BEGIN

dtrace: description 'BEGIN' matched 1 probe

CPU   ...
manish@belenix-KDE4:~/WorkOut/
DTraceTutorial$ pfexec dtrace -n BEGIN -n END

dtrace: description 'BEGIN' matched 1 probe
...
• The probe BEGIN fires every time you
  start a new tracing request

• The probe END fires every time you exit
  DTrace. In...
Hello, World!



                21
BEGIN

{

    trace("hello, world");

         exit(0);

}




                             22
Output..
manish@belenix-KDE4:~/WorkOut/DTraceTutorial/1-
HelloWorld$ pfexec dtrace -s hello.d



dtrace: script 'hello.d' ...
61,809
DTrace probes on the system!




   pfexec dtrace -l | wc -l


                               24
DTrace Architecture
  Source: http://wikis.sun.com/download/attachments/10390716/architecture.gif
                        ...
II. What / Where / How



                         26
• Navigate to the directory having the Qt
  source code

• Find out a good place in QObject to put
  one

• Start writing ...
Hack!



        28
Upcoming SlideShare
Loading in …5
×

D trace kde4presentation

992 views

Published on

1 Comment
0 Likes
Statistics
Notes
  • Be the first to like this

No Downloads
Views
Total views
992
On SlideShare
0
From Embeds
0
Number of Embeds
7
Actions
Shares
0
Downloads
1
Comments
1
Likes
0
Embeds 0
No embeds

No notes for slide

D trace kde4presentation

  1. 1. Dynamically Tracing KDE Manish Chakravarty ThoughtWorks Studios 1
  2. 2. Agenda • Learn about DTrace • Learn what and where to Trace • Trace! 2
  3. 3. I. What is DTrace? While I go through the slides, please start copying the VM! 3
  4. 4. DTrace is.. • a comprehensive Dynamic Tracing framework created by Sun Microsystems for troubleshooting kernel and application problems in real time. 4
  5. 5. Excuse me? 5
  6. 6. • Dtrace enables us to “look into” the internals of a running production application and allows us to instrument it • It can do very neat stuff in the kernel as well, but that’s not the point of this session 6
  7. 7. So how does DTrace work? 7
  8. 8. • Dtrace allows you to dynamically modify the operating system kernel and user processes to record additional data that you specify at locations of interest, called probes 8
  9. 9. • Dtrace probes come from a set of kernel modules called providers, each of which performs a particular type of instrumentation to create probes 9
  10. 10. Provider:Module:Function:Name 10
  11. 11. Provider The name of the DTrace provider that is publishing this probe 11
  12. 12. Module If this probe corresponds to a specific program location, the name of the module which the probe is located The name is either the name of a kernel module or a user library 12
  13. 13. Function If this probe corresponds to a specific program location, the name of the program function in which the probe is located 13
  14. 14. Name The final component of the probe name is a name that gives you some idea of the probe’s semantic meaning such as BEGIN or END 14
  15. 15. Thus: Provider:Module:Function:Name 15
  16. 16. DTrace Architecture 16
  17. 17. Let’s start Tracing! 17
  18. 18. manish@belenix-KDE4:~/WorkOut/ DTraceTutorial$ pfexec dtrace -n BEGIN dtrace: description 'BEGIN' matched 1 probe CPU ID FUNCTION:NAME 0 1 :BEGIN ^C 18
  19. 19. manish@belenix-KDE4:~/WorkOut/ DTraceTutorial$ pfexec dtrace -n BEGIN -n END dtrace: description 'BEGIN' matched 1 probe dtrace: description 'END' matched 1 probe CPU ID FUNCTION:NAME 0 1 :BEGIN ^C 0 2 :END 19
  20. 20. • The probe BEGIN fires every time you start a new tracing request • The probe END fires every time you exit DTrace. In this case hitting Ctrl-C triggered it. 20
  21. 21. Hello, World! 21
  22. 22. BEGIN { trace("hello, world"); exit(0); } 22
  23. 23. Output.. manish@belenix-KDE4:~/WorkOut/DTraceTutorial/1- HelloWorld$ pfexec dtrace -s hello.d dtrace: script 'hello.d' matched 1 probe CPU ID FUNCTION:NAME 0 1 :BEGIN hello, world 23
  24. 24. 61,809 DTrace probes on the system! pfexec dtrace -l | wc -l 24
  25. 25. DTrace Architecture Source: http://wikis.sun.com/download/attachments/10390716/architecture.gif 25
  26. 26. II. What / Where / How 26
  27. 27. • Navigate to the directory having the Qt source code • Find out a good place in QObject to put one • Start writing probes! 27
  28. 28. Hack! 28

×