Changeset 82dc7d8 for test/test-wtf.c


Ignore:
Timestamp:
02/23/06 13:51:28 (16 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:
208f694
Parents:
8ea5b38
Message:

Lots of cleanups
Added test-event

File:
1 edited

Legend:

Unmodified
Added
Removed
  • test/test-wtf.c

    r1b4901a r82dc7d8  
    4949#include "libtrace.h"
    5050
    51 struct libtrace_t *trace;
    5251
    5352int main(int argc, char *argv[]) {
     
    5655        int error = 0;
    5756        int count = 0;
    58         struct libtrace_packet_t *packet;
     57        int level = 0;
     58        libtrace_t *trace;
     59        libtrace_out_t *outtrace;
     60        libtrace_packet_t *packet;
    5961
    6062        trace = trace_create(uri);
    6163        if (!trace) {
    62                 printf("ERROR: %s\n",trace_err.problem);
     64                printf("Error: %s\n",trace_err.problem);
     65                return 1;
     66        }
     67        outtrace = trace_create_output("wtf:traces/wed.out.wtf");
     68        if (!outtrace) {
     69                printf("Error: %s\n",trace_err.problem);
    6370                return 1;
    6471        }
    6572
    66         if (trace_start(trace)==-1) {
    67                 printf("ERROR: %s\n",trace_err.problem);
    68                 return 1;
    69         }
     73        level=0;
     74        trace_config_output(outtrace,TRACE_OPTION_OUTPUT_COMPRESS,&level);
     75
     76        trace_start(trace);
     77        trace_start_output(outtrace);
    7078       
    71         packet = trace_create_packet();
     79        packet=trace_create_packet();
    7280        for (;;) {
    7381                if ((psize = trace_read_packet(trace, packet)) <0) {
     
    8088                }
    8189                count ++;
     90                trace_write_packet(outtrace,packet);
    8291        }
    8392        trace_destroy_packet(&packet);
     
    93102        }
    94103        trace_destroy(trace);
     104        trace_destroy_output(outtrace);
    95105        return error;
    96106}
Note: See TracChangeset for help on using the changeset viewer.