4.0.1-hotfixescachetimestampsdevelopdpdk-ndagetsilivegetfragoffhelplibtrace4ndag_formatpfringrc-4.0.1rc-4.0.2rc-4.0.3rc-4.0.4ringdecrementfixringperformanceringtimestampfixes
Last change
on this file since 11c4044 was
e3b0188,
checked in by Daniel Lawson <dlawson@…>, 17 years ago
|
a lot of changes for cross-compilation support
- header ordering
- os-specific headers
- an lt_inttypes.h which defines PRIu64 etc for platforms that don't have them
- removed daglegacy.h, merged with dagformat.h
|
-
Property mode set to
100644
|
File size:
901 bytes
|
Line | |
---|
1 | #include <netdb.h> |
---|
2 | #include <inttypes.h> |
---|
3 | #include <lt_inttypes.h> |
---|
4 | #include <stdio.h> |
---|
5 | #include "libtrace.h" |
---|
6 | #include "tracereport.h" |
---|
7 | |
---|
8 | static uint64_t dir_bytes[8]; |
---|
9 | static uint64_t dir_packets[8]; |
---|
10 | |
---|
11 | void dir_per_packet(struct libtrace_packet_t *packet) |
---|
12 | { |
---|
13 | dir_bytes[trace_get_direction(packet)]+=trace_get_wire_length(packet); |
---|
14 | ++dir_packets[trace_get_direction(packet)]; |
---|
15 | } |
---|
16 | |
---|
17 | void dir_report(void) |
---|
18 | { |
---|
19 | int i; |
---|
20 | printf("# Direction\n"); |
---|
21 | printf("%-20s \t%12s\t%12s\n","Direction","bytes","packets"); |
---|
22 | for(i=0;i<8;++i) { |
---|
23 | if (!dir_packets[i]) |
---|
24 | continue; |
---|
25 | switch(i) { |
---|
26 | case 0: printf("%20s:\t%12" PRIu64 "\t%12" PRIu64 "\n", |
---|
27 | "in",dir_bytes[i],dir_packets[i]); |
---|
28 | break; |
---|
29 | case 1: printf("%20s:\t%12" PRIu64 "\t%12" PRIu64 "\n", |
---|
30 | "out",dir_bytes[i],dir_packets[i]); |
---|
31 | break; |
---|
32 | default: printf("%20i:\t%12" PRIu64 "\t%12" PRIu64 "\n", |
---|
33 | i,dir_bytes[i],dir_packets[i]); |
---|
34 | break; |
---|
35 | } |
---|
36 | } |
---|
37 | } |
---|
Note: See
TracBrowser
for help on using the repository browser.