Ignore:
Timestamp:
03/22/06 14:25:34 (15 years ago)
Author:
Shane Alcock <salcock@…>
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:
4af54d1
Parents:
9c4b5e3
Message:

Updated rate-dir and rate for libtrace 3

File:
1 edited

Legend:

Unmodified
Added
Removed
  • examples/rate/rate.c

    rd56089a rc219603  
    9696        struct libtrace_ip *ipptr = 0;
    9797        struct libtrace_packet_t *packet = trace_create_packet();
     98        libtrace_err_t trace_err;
    9899
    99100        uint32_t last_second = 0;
     
    107108        // create an trace to uri
    108109        trace = trace_create(uri);
     110        if (trace_is_err(trace)) {
     111                trace_err = trace_get_err(trace);
     112                printf("Error in trace_create: %s\n", trace_err.problem);
     113                return -1;
     114        }
     115        trace_start(trace);
     116        if (trace_is_err(trace)) {
     117                trace_err = trace_get_err(trace);
     118                printf("Error in trace_start: %s\n", trace_err.problem);
     119                return -1;
     120        }
    109121
    110122
    111123        for (;;) {
    112                 if ((psize = trace_read_packet(trace,&packet)) < 1) {
     124                if ((psize = trace_read_packet(trace,packet)) < 1) {
    113125                        // terminate
    114126                        break;
     
    118130                }
    119131
    120                 if((ipptr = trace_get_ip(&packet)) == 0) {
     132                if((ipptr = trace_get_ip(packet)) == 0) {
    121133                        continue;
    122134                }
     
    125137                counter[PACKETS][INSTANT] ++;
    126138
    127                 ts = trace_get_seconds(&packet);
     139                ts = trace_get_seconds(packet);
    128140                if(last_second == 0) {
    129141                        last_second = (int)ts;
Note: See TracChangeset for help on using the changeset viewer.