next up previous contents index
Next: 22.2.4 Some Generic Commands Up: 22.2 Ns commands for Previous: 22.2.2 Link/Queue

22.2.3 Agent and Features

Agents are used to separate protocol states from nodes. They are always associated with nodes. An agent has a name, which is a unique identifier of the agent. It is shown as a square with its name inside, and a line link the square to its associated node. The following are commands that support agent tracing:

$ns add-agent-trace \ \ \
$ns delete-agent-trace \
$ns monitor-agent-trace \

Once the above command is used to create an agent in nam trace, the tracevar method of the agent can be used to create feature traces of a given variable in the agent. For example, the following code segment creates traces of the variable C1_ in an SRM agent $srm(0):

        $ns attach-agent $n($i) $srm(0)
        $ns add-agent-trace $srm($i) srm(0)
        $ns monitor-agent-trace $srm(0) ;# turn nam monitor on from the start
        $srm(0) tracevar C1_