[Click] SetCycle + CycleCountAccum

Eddie Kohler kohler at cs.ucla.edu
Mon Jun 7 23:30:28 EDT 2004


Xavier Grandmougin wrote:
> Hi all,
> 
> I'm running click-1.4pre1 as a kernel module of linux 2.4.21 on a 
> Pentium III 450.
> I'm trying to measure the end to end latency of my router. I've put a 
> SetCycleCount just after each FromDevice elements.
> It seems to work correctly if I put the CycleCountAccum anywhere before 
> the ARPQuerier : I get a latency of a few µs (about 1 µs per element). 
> But if I put it anywhere after, I get some huge values of hundreds 
> seconds !?
> What did I miss ?
> 
> Thanx
> Xavier
> 
> PS: here is my config file

Hi Xavier,

There are probably two things going on.

(1) ARPQuerier generates ARP queries and emits them.  Since it makes these 
packets from scratch, they have cycle count annotation = 0!  CycleCountAccum 
will do the equivalent of:

       current_cycle_count = click_get_cycle_count();  /* huge: 10^8 or more*/
       _accum_difference += packet->cycle_count() - current_cycle_count;
                                /* _accum_difference += 10^8 - 0 == 10^8! */

You can avoid this by supplying ARPQuerier with two outputs.  The first output 
will be for IP-in-EThernet packets; put hte CycleCountAccum there.  The second 
output is for ARP queries; don't put CycleCountAccum there.  So for example:

      querier0:: ARPQuerier(...);
      querier0[0] -> CycleCountAccum -> queue0;
      querier0[1] -> queue0;

(2) ARPQuerier holds on to packets for a while (like a Queue), if it needs to 
make an ARP query.  So even without (1) you'll see large numbers (but not 00's 
of seconds).

I'm going to change CycleCountAccum to ignore packets with cycle count anno == 
0, so that problems like (1) will be less frequent.

Thanks for the report,
Eddie


> 
> //----------------------------------------------------------------------/
> // Click configuration file 3 : let the perfs be evaluated !
> //     Author : Xavier GRANDMOUGIN <xavier.grandmougin at libertysurf.fr>
> //    Date of creation : 18/05/2004
> //----------------------------------------------------------------------/
> 
> 
> //
> //     +---------+
> //    /           \                                  /+-----------+\
> //   |             |       +-----------+             |              |
> //   |  VIDEO      |   **********   *************    |  VIDEO       |
> //   |  SERVER     |===*  eth1  *   *    eth0   *=== |  CLIENT      |
> //   |             |===*10.0.0.1*   *192.168.1.1*=== |************* |
> //   |*************|   **********   *************    |*eth_client * |
> //   |*eth_server *|       |  ROUTER   |             |*192.168.1.2* |
> //   |* 10.0.0.2  *|       +-----------+             |************* |
> //   \************/                                  \+------------+/
> //    +----------+
> //
> 
> 
> //AddressInfo :  Define names for IP and ETHERNET addresses
> //for future use in the script since it is more easy to
> //handle name that numeric addresses
> //              IP ADDRESS    IP NETWORK ADDRESS   ETHERNET ADDRESS
> AddressInfo(
>     eth0          192.168.1.1     192.168.1.0/24  00:04:75:d4:25:c2,
>     eth1          10.0.0.1        10.0.0.0/8      00:c0:4f:32:8a:24,
>     eth_client    192.168.1.2                     00:c0:4f:32:8a:46,
>     eth_server    10.0.0.2                        00:c0:4f:9c:29:e7,
> );
> 
> 
> 
> //------------------------------//
> //                              //
> //    Compound elements    //
> //                              //
> //------------------------------//
> 
> 
> // Compound element : from_device_class
> // Abstract : Make a copy of the packets from $device for the sniffer
> // Input : none
> // Output : packets from $device
> elementclass from_device_class {
>     $device |
>     // Declarations
>     from_device :: FromDevice($device);
>     copy_for_sniffing :: Tee;
>     // Connections
>     from_device -> SetCycleCount -> copy_for_sniffing;
>     copy_for_sniffing[1] -> ToHostSniffers($device);
>     copy_for_sniffing[0] -> output;
> }
> 
> 
> // Compound element : to_device_class
> // Abstract : Make a copy for the sniffer, and send them to $device
> // Input : packets
> // Ouput : none
> elementclass to_device_class {
>     $device |
>     // Declarations
>     to_device :: ToDevice($device);
>     copy_for_sniffing :: PullTee;
>     // Connections
>     input -> copy_for_sniffing;
>     copy_for_sniffing[1] -> ToHostSniffers($device);
>     copy_for_sniffing[0] -> to_device;
> }
> 
> 
> // Compound element : IP routing
> // Abstract : Route IP packets to the correct destination
> // Input : IP packets
> // Ouput : IP packets for eth0 in output 0, packets for eth1 in output 1
> elementclass ip_routing_class {
>     // Declaration
>     ip_classifier :: IPClassifier(dst host eth_client,
>                 dst host eth_server,
>                 dst host eth0,
>                 dst host eth1,
>                 -);
>     // Connections
>     input -> CheckIPHeader -> GetIPAddress(16) -> ip_classifier;
>     
>     // IP packets for localhost
>     ip_classifier[2] -> EtherEncap(0x0800, 1:1:1:1:1:1, eth0) -> ToHost;
>     ip_classifier[3] -> EtherEncap(0x0800, 1:1:1:1:1:1, eth1) -> ToHost;
> 
>     // IP packets for graveyard
>     ip_classifier[4] -> Discard;
> 
>     // IP packets for eth0
>     ip_classifier[0] -> [0]output;
>     // IP packets for eth1
>     ip_classifier[1] -> [1]output;
> }
> 
> 
> 
> //----------------------//
> //                      //
> //    Declarations    //
> //                      //
> //----------------------//
> 
> // Devices
> from_client :: from_device_class(eth0);
> from_server :: from_device_class(eth1);
> to_client :: to_device_class(eth0);
> to_server :: to_device_class(eth1);
> 
> queue0 :: Queue(5000);
> queue1 :: Queue(5000);
> 
> classifier0 :: Classifier(    12/0806 20/0001,
>                 12/0806 20/0002,
>                 12/0800,
>                 -);
> classifier1 :: Classifier(    12/0806 20/0001,
>                 12/0806 20/0002,
>                 12/0800,
>                 -);
> 
> // ARP
> responder0 :: ARPResponder(eth0);
> responder1 :: ARPResponder(eth1);
> querier0 :: ARPQuerier(eth0);
> querier1 :: ARPQuerier(eth1);
> 
> ip_packet :: Strip(14);
> ip_routing :: ip_routing_class;
> 
> tee0 :: Tee;
> tee1 :: Tee;
> 
> 
> 
> //----------------------//
> //                      //
> //    Connections    //
> //                      //
> //----------------------//
> 
> // Head
> from_client -> classifier0;
> from_server -> classifier1;
> 
> // Packet classification
> //  ARP queries
> classifier0[0] -> responder0;
> classifier1[0] -> responder1;
> //  ARP replies
> classifier0[1] -> tee0;
>     tee0[0] -> [1]querier0;
>     tee0[1] -> ToHost;
> classifier1[1] -> tee1;
>     tee1[0] -> [1]querier1;
>     tee1[1] -> ToHost;
> //  IP
> classifier0[2] -> ip_packet;
> classifier1[2] -> ip_packet;
> ip_packet -> ip_routing;
>     ip_routing[0] -> [0]querier0;
>     ip_routing[1] -> [0]querier1;
> //  other
> classifier0[3] -> Discard;
> classifier1[3] -> Discard;
> 
> // Tail
> responder0 -> queue0;
> responder1 -> queue1;
> querier0 -> CycleCountAccum -> queue0;
> querier1 -> queue1;
> queue0 -> to_client;
> queue1 -> to_server;
> 
> 
> 
> _______________________________________________
> click mailing list
> click at amsterdam.lcs.mit.edu
> https://amsterdam.lcs.mit.edu/mailman/listinfo/clic
> k



More information about the click mailing list