| 24 | int info_count = (sizeof(info) / sizeof(info[0])); |
| 25 | |
| 26 | int |
| 27 | main (int argc, char **argv) |
| 28 | { |
| 29 | unsigned opt_count = 1; |
| 30 | unsigned opt_extra = 0; |
| 31 | |
| 32 | struct employee { |
| 33 | const char *e_first; |
| 34 | const char *e_last; |
| 35 | unsigned e_dept; |
| 36 | } employees[] = { |
| 37 | { "Terry", "Jones", 660 }, |
| 38 | { "Leslie", "Patterson", 341 }, |
| 39 | { "Ashley", "Smith", 1440 }, |
| 40 | { NULL, NULL } |
| 41 | }, *ep; |
| 42 | |
| 43 | argc = xo_parse_args(argc, argv); |
| 44 | if (argc < 0) |
| 45 | return 1; |
| 46 | |
| 47 | for (argc = 1; argv[argc]; argc++) { |
| 48 | if (xo_streq(argv[argc], "count")) { |
| 49 | if (argv[argc + 1]) |
| 50 | opt_count = atoi(argv[++argc]); |
| 51 | } else if (xo_streq(argv[argc], "extra")) { |
| 52 | if (argv[argc + 1]) |
| 53 | opt_extra = atoi(argv[++argc]); |
| 54 | } |
| 55 | } |
| 56 | |
| 57 | xo_set_info(NULL, info, info_count); |
| 58 | |
| 59 | xo_open_container("employees"); |
| 60 | xo_open_list("employee"); |
| 61 | |
| 62 | xo_emit("[{:extra/%*s}]\n", opt_extra, ""); |
| 63 | |
| 64 | xo_emit("{T:/%13s} {T:/%5s} {T:/%6s} {T:/%7s} {T:/%8s} {T:Size(s)}\n", |
| 65 | "Type", "InUse", "MemUse", "HighUse", "Requests"); |
| 66 | xo_open_list("memory"); |
| 67 | xo_open_instance("memory"); |
| 68 | |
| 69 | #define PRIu64 "llu" |
| 70 | #define TO_ULL(_x) ((unsigned long long) _x) |
| 71 | xo_emit("{k:type/%13s} {:in-use/%5" PRIu64 "} " |
| 72 | "{:memory-use/%5" PRIu64 "}{U:K} {:high-use/%7s} " |
| 73 | "{:requests/%8" PRIu64 "} ", |
| 74 | "name", TO_ULL(12345), TO_ULL(54321), "-", TO_ULL(32145)); |
| 75 | |
| 76 | int first = 1, i; |
| 77 | #if 0 |
| 78 | xo_open_list("size"); |
| 79 | for (i = 0; i < 32; i++) { |
| 80 | if (!first) |
| 81 | xo_emit(","); |
| 82 | xo_emit("{l:size/%d}", 1 << (i + 4)); |
| 83 | first = 0; |
nothing calls this directly
no test coverage detected