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