Changeset a472b50


Ignore:
Timestamp:
05/23/06 13:23:06 (15 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:
11c4044
Parents:
0837e57
Message:

Support filtering (but no command line for it yet)
Support libtrace3

File:
1 edited

Legend:

Unmodified
Added
Removed
  • tools/tracereport/tracereport.c

    rc3e6e47 ra472b50  
    2929 */
    3030
    31 //
    32 // This program takes a series of traces and bpf filters and outputs how many
    33 // bytes/packets
     31/* This program takes a series of traces and bpf filters and outputs how many
     32 * bytes/packets
     33 */
    3434
    3535#include <stdio.h>
     
    5959
    6060/* Process a trace, counting packets that match filter(s) */
    61 void run_trace(char *uri)
     61void run_trace(char *uri, libtrace_filter_t *filter, int count)
    6262{
    6363        struct libtrace_packet_t *packet = trace_create_packet();
     
    6868        if (trace_is_err(trace)) {
    6969                trace_perror(trace,"trace_create");
    70                 return 1;
     70                return;
     71        }
     72
     73        if (filter) {
     74                trace_config(trace,TRACE_OPTION_FILTER,filter);
    7175        }
    7276
    7377        if (trace_start(trace)==-1) {
    7478                trace_perror(trace,"trace_start");
    75                 return 1;
     79                return;
    7680        }
    7781
    7882        for (;;) {
    7983                int psize;
     84                if (count--<1)
     85                        break;
    8086                if ((psize = trace_read_packet(trace, packet)) <1) {
    8187                        break;
     
    104110        int i;
    105111
     112        /*char *filterstring="host 130.197.127.210"; */
     113
     114        libtrace_filter_t *filter = NULL;/*trace_bpf_setfilter(filterstring); */
    106115
    107116        for(i=1;i<argc;++i) {
    108                 run_trace(argv[i]);
     117                run_trace(argv[i],filter,1000);
    109118        }
    110119
Note: See TracChangeset for help on using the changeset viewer.