Changeset 34e22d1 for tools


Ignore:
Timestamp:
09/05/07 13:50:34 (14 years ago)
Author:
Perry Lorier <perry@…>
Branches:
4.0.1-hotfixes, cachetimestamps, develop, dpdk-ndag, etsilive, getfragoff, help, libtrace4, master, ndag_format, pfring, rc-4.0.1, rc-4.0.2, rc-4.0.3, rc-4.0.4, ringdecrementfix, ringperformance, ringtimestampfixes
Children:
39aa3c7
Parents:
1708aa8
Message:

Allow setting different interfaces_per_input

Location:
tools/tracemerge
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • tools/tracemerge/tracemerge.1

    r634089d r34e22d1  
    44.SH SYNOPSIS
    55.B tracemerge
    6 [ \-i | \-\^\-set-interface ]
     6[ \-i [ interfaces_per_input ] | \-\^\-set-interface [ interfaces_per_input ] ]
    77[ \-u | \-\^\-unique-packets ]
    88outputuri inputuri...
     
    1212.TP
    1313.PD 0
    14 .BI \-i
     14.BI \-i [ interfaces_per_input ]
    1515.TP
    1616.PD
    17 .BI \-\^\-set-interface
    18 replace the "interface" bits in the erf header (or the "direction" bit in
    19 other trace files) to be 0 for the first file, 1 for the second file etc.
     17.BI \-\^\-set-interface [interfaces_per_input ]
     18set the interface ("direction") for each input to be unique.  The optional
     19inputs_per_interface parameter is how many inputs to reserve for each trace,
     20and defaults to 1.  Thus if you have two traces with two interfaces (in/out),
     21and interfaces_per_input is set to 2, then tracemerge will have the first
     22interface of the first input will be 0, the second interface of the first input
     23will be 1, the first interface of the second input will be 2, and the second
     24interface of the second input will be 3.
     25
     26Beware that erf only supports 4 interfaces, and pcap only supports 2.
     27Limitations apply based on the input trace format (not the output trace format)
    2028
    2129.TP
  • tools/tracemerge/tracemerge.c

    r2cf30f6 r34e22d1  
    1111        fprintf(stderr,"Usage:\n"
    1212        "%s flags outputuri traceuri [traceuri...]\n"
    13         "-i --set-interface     Each trace is allocated an interface. Default leaves this flag as read from the original traces, if appropriate\n"
     13        "-i [interfaces_per_input] --set-interface [interfaces_per_input]\n"
     14        "                       Each trace is allocated an interface. Default leaves this flag as read from the original traces, if appropriate\n"
    1415        "-u --unique-packets    Discard duplicate packets\n"
    1516        "-H --libtrace-help     Print libtrace runtime documentation\n"
     
    3233        struct libtrace_packet_t **packet;
    3334        bool *live;
    34         bool set_interface=false;
     35        int interfaces_per_input=0;
    3536        bool unique_packets=false;
    3637        int i=0;
     
    4142                int option_index;
    4243                struct option long_options[] = {
    43                         { "set-interface",      0, 0, 'i' },
     44                        { "set-interface",      2, 0, 'i' },
    4445                        { "unique-packets",     0, 0, 'u' },
    4546                        { "libtrace-help",      0, 0, 'H' },
     
    4748                };
    4849
    49                 int c=getopt_long(argc, argv, "iuH",
     50                int c=getopt_long(argc, argv, "i::uH",
    5051                                long_options, &option_index);
    5152
     
    5455
    5556                switch (c) {
    56                         case 'i': set_interface=true; break;
     57                        case 'i':
     58                                if (optarg)
     59                                        interfaces_per_input=atoi(optarg);
     60                                else
     61                                        interfaces_per_input=1;
     62                                break;
    5763                        case 'u': unique_packets=true; break;
    5864                        case 'H':
     
    113119                uint64_t oldest_ts=0;
    114120                int oldest=-1;
     121                int curr_dir;
    115122                if (done)
    116123                        break;
     
    146153                live[oldest]=false;
    147154
    148                 if (set_interface)
    149                         trace_set_direction(packet[oldest],oldest);
     155                curr_dir = trace_get_direction(packet[oldest]);
     156                if (curr_dir != -1 && interfaces_per_input) {
     157                        /* If there are more interfaces than
     158                         * interfaces_per_input, then clamp at the
     159                         * highest input.  This means things should
     160                         * end up in "OTHER" or the unused 3rd bin if
     161                         * we're lucky */
     162                        curr_dir = curr_dir < interfaces_per_input
     163                                ? curr_dir
     164                                : interfaces_per_input-1;
     165
     166                        trace_set_direction(packet[oldest],
     167                                        oldest*interfaces_per_input
     168                                        +curr_dir);
     169                }
    150170
    151171                if (unique_packets && oldest_ts == last_ts)
Note: See TracChangeset for help on using the changeset viewer.