4P13
Lab 4
Objective
Lab Component
"dtrace" scripting is based on the D Langue. D language scripts can
be written with variables and predicates to monitor the kernel and
produce useful statistics. For this lab you will write some basic
scripts to monitor processes.
To start: go to the website http://dtrace.org/guide/preface.html.
The introduction is fairly informative and gives a nice tutorial
into D scripting, some of which you have done last week. Read
through the introduction and implement the examples.
Lets go back to our TCP/IP echos and echoc. Write a script which
accepts to process IDs of each process and output the TCP/IP network
calls to the kernel in a format similar to the trussrw example. In
fact you can use the trussrw.c as a starting point. Just connect
echo using local machine sockets, that is 127.0.0.1, hard code these
if you wish. Remember the provider will be the network sctp. You
should be able to monitor connections and such using dtrace between
echoc and echos.
As a resource the rest of the guide will serve as a how to. D is
very similar to C and thus shares much of the same syntax. Some of
the guide refers to Illumos specific installations. FreeBSD has most
the implementation, but will be missing some of the esoteric
functionality, such as mdb debugger.
Reward Requirements
- Write a 1 page mini report of what you have learned from the
above exercise. Give some examples where this will be useful for
debugging programs such as the echo example.
- When you come back from break, hand in a commented D script of
the above exercise. In addition, show your instructor that it
works.
- Instructor will grade your lab and assign a mark based on how
thorough he perceives that you have understood the material.