4.0.1-hotfixescachetimestampsdevelopdpdk-ndagetsilivegetfragoffhelplibtrace4ndag_formatpfringrc-4.0.1rc-4.0.2rc-4.0.3rc-4.0.4ringdecrementfixringperformanceringtimestampfixes
Last change
on this file since ddfc46d was
a8f2692,
checked in by Perry Lorier <perry@…>, 13 years ago
|
Tidy up a bazillion tiny warnings
|
-
Property mode set to
100644
|
File size:
1.2 KB
|
Line | |
---|
1 | #include "output.h" |
---|
2 | #include <stdio.h> |
---|
3 | #include <stdlib.h> |
---|
4 | #include <inttypes.h> |
---|
5 | #include <lt_inttypes.h> |
---|
6 | #include <string.h> |
---|
7 | |
---|
8 | #define COLWIDTH 11 |
---|
9 | |
---|
10 | static void output_txt_init(struct output_data_t *out) |
---|
11 | { |
---|
12 | int i; |
---|
13 | for(i=0;i<out->columns;++i) { |
---|
14 | if (strlen(out->labels[i])>8) |
---|
15 | printf("[%i]: %s\n",i,out->labels[i]); |
---|
16 | } |
---|
17 | printf("\n"); |
---|
18 | for(i=0;i<out->columns;++i) { |
---|
19 | if (strlen(out->labels[i])>8) |
---|
20 | printf("[%*i] ",COLWIDTH-3,i); |
---|
21 | else |
---|
22 | printf("%*s ",COLWIDTH-1,out->labels[i]); |
---|
23 | } |
---|
24 | printf("\n"); |
---|
25 | } |
---|
26 | |
---|
27 | static void output_txt_flush(struct output_data_t *out) |
---|
28 | { |
---|
29 | int i; |
---|
30 | for(i=0;i<out->columns;++i) { |
---|
31 | switch (out->data[i].type) { |
---|
32 | case TYPE_int: |
---|
33 | printf("%*" PRIu64 " ",COLWIDTH-1,out->data[i].d.d_int); |
---|
34 | break; |
---|
35 | case TYPE_str: |
---|
36 | printf("%*s ",COLWIDTH-1,out->data[i].d.d_str); |
---|
37 | free(out->data[i].d.d_str); |
---|
38 | break; |
---|
39 | case TYPE_float: |
---|
40 | printf("%*f ",COLWIDTH-1,out->data[i].d.d_float); |
---|
41 | break; |
---|
42 | case TYPE_time: |
---|
43 | printf("%*.0f ",COLWIDTH-1,out->data[i].d.d_time); |
---|
44 | break; |
---|
45 | } |
---|
46 | } |
---|
47 | printf("\n"); |
---|
48 | } |
---|
49 | |
---|
50 | static void output_txt_destroy(struct output_data_t *out) |
---|
51 | { |
---|
52 | (void)out; |
---|
53 | /* Do nothing */ |
---|
54 | } |
---|
55 | |
---|
56 | struct output_type_t output_txt = { |
---|
57 | .name= "txt", |
---|
58 | .init= output_txt_init, |
---|
59 | .flush= output_txt_flush, |
---|
60 | .destroy= output_txt_destroy, |
---|
61 | }; |
---|
Note: See
TracBrowser
for help on using the repository browser.