4.0.1-hotfixescachetimestampsdevelopdpdk-ndagetsilivegetfragoffhelplibtrace4ndag_formatpfringrc-4.0.1rc-4.0.2rc-4.0.3rc-4.0.4ringdecrementfixringperformanceringtimestampfixes
Last change
on this file since 9c4b5e3 was
3d4fb8f,
checked in by Perry Lorier <perry@…>, 16 years ago
|
Cleanup the tools
|
-
Property mode set to
100644
|
File size:
995 bytes
|
Rev | Line | |
---|
[65cdb7f] | 1 | #include "output.h" |
---|
| 2 | #include <stdio.h> |
---|
| 3 | #include <stdlib.h> |
---|
[e3b0188] | 4 | #include <inttypes.h> |
---|
| 5 | #include <lt_inttypes.h> |
---|
[65cdb7f] | 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: |
---|
[e3b0188] | 25 | printf("%" PRIu64,out->data[i].d.d_int); |
---|
[65cdb7f] | 26 | break; |
---|
| 27 | case TYPE_str: |
---|
[e3b0188] | 28 | printf("%s",out->data[i].d.d_str); |
---|
| 29 | free(out->data[i].d.d_str); |
---|
[65cdb7f] | 30 | break; |
---|
| 31 | case TYPE_float: |
---|
[e3b0188] | 32 | printf("%f",out->data[i].d.d_float); |
---|
[65cdb7f] | 33 | break; |
---|
| 34 | case TYPE_time: |
---|
[e3b0188] | 35 | printf("%.03f",out->data[i].d.d_time); |
---|
[65cdb7f] | 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 | } |
---|
| 46 | |
---|
| 47 | struct output_type_t output_csv = { |
---|
[3d4fb8f] | 48 | .name= "csv", |
---|
| 49 | .init= output_csv_init, |
---|
| 50 | .flush= output_csv_flush, |
---|
| 51 | .destroy= output_csv_destroy, |
---|
[65cdb7f] | 52 | }; |
---|
Note: See
TracBrowser
for help on using the repository browser.