X-Git-Url: http://git.lttng.org./?a=blobdiff_plain;f=genevent%2Fgenevent.c;h=fd7b2b73900e73f9f088ebb8ab9fab5f3f2acca6;hb=99c5a0863a248fe49e6fb0463e0661673f1c8f67;hp=220cbd70f7a36f3ff97c6ace13196bfc31b811c8;hpb=2fef3d3e1a0425e9aeedbf4b7c2e7af5d13869ef;p=lttv.git diff --git a/genevent/genevent.c b/genevent/genevent.c index 220cbd70..fd7b2b73 100644 --- a/genevent/genevent.c +++ b/genevent/genevent.c @@ -1475,8 +1475,6 @@ int print_event_logging_function(char *basename, facility_t *fac, print_tabs(1, fd); } fprintf(fd, "u64 tsc;\n"); - print_tabs(1, fd); - fprintf(fd, "size_t before_hdr_pad, after_hdr_pad, header_size;\n"); fprintf(fd, "\n"); if(!event->force) { @@ -1579,9 +1577,7 @@ int print_event_logging_function(char *basename, facility_t *fac, print_tabs(2, fd); fprintf(fd, "buffer = ltt_reserve_slot(trace, channel, &transport_data,\n"); print_tabs(3, fd); - fprintf(fd, "reserve_size, &slot_size, &tsc,\n"); - print_tabs(3, fd); - fprintf(fd, "&before_hdr_pad, &after_hdr_pad, &header_size);\n"); + fprintf(fd, "reserve_size, &slot_size, &tsc);\n"); /* If error, return */ print_tabs(2, fd); fprintf(fd, "if (!buffer)\n"); @@ -1597,31 +1593,37 @@ int print_event_logging_function(char *basename, facility_t *fac, /* Write event header */ if(strcmp("compact", fac->name) != 0) { print_tabs(2, fd); - fprintf(fd, "ltt_write_event_header(trace, channel, buffer,\n"); + fprintf(fd, "buffer = ltt_write_event_header(trace, channel, buffer,\n"); print_tabs(3, fd); fprintf(fd, "ltt_facility_%s_%X, event_%s_%s,\n", fac->name, fac->checksum, fac->name, event->name); print_tabs(3, fd); - fprintf(fd, "reserve_size, before_hdr_pad, tsc);\n"); + fprintf(fd, "reserve_size, tsc);\n"); } else { print_tabs(2, fd); - fprintf(fd, "ltt_write_compact_header(trace, channel, buffer,\n"); + fprintf(fd, "buffer = ltt_write_compact_header(trace, channel, buffer,\n"); print_tabs(3, fd); fprintf(fd, "ltt_facility_%s_%X, event_%s_%s,\n", fac->name, fac->checksum, fac->name, event->name); print_tabs(3, fd); - fprintf(fd, "reserve_size, before_hdr_pad, tsc, compact_data);\n"); + if(event->compact_data) { + assert(event->fields.position > 0); + field_t *field = (field_t*)(event->fields.array[0]); + fprintf(fd, "reserve_size, tsc, lttng_param_%s);\n", + field->name); + } else + fprintf(fd, "reserve_size, tsc, 0);\n"); } - print_tabs(2, fd); - fprintf(fd, "*to_base += before_hdr_pad + after_hdr_pad + header_size;\n"); - fprintf(fd, "\n"); /* write data. */ for(unsigned int i=0;ifields.position;i++){ field_t *field = (field_t*)(event->fields.array[i]); type_descriptor_t *type = field->type; - + + /* First param is compacted in the header */ + if(event->compact_data && i == 0) + continue; /* Set from */ print_tabs(2, fd); switch(type->type) { @@ -2015,8 +2017,6 @@ int print_event_logging_function_user_fast(char *basename, facility_t *fac, } fprintf(fd, "uint64_t tsc;\n"); print_tabs(1, fd); - fprintf(fd, "size_t before_hdr_pad, after_hdr_pad, header_size;\n"); - fprintf(fd, "\n"); print_tabs(1, fd); fprintf(fd, "if (!trace) {\n"); @@ -2102,9 +2102,7 @@ int print_event_logging_function_user_fast(char *basename, facility_t *fac, print_tabs(2, fd); fprintf(fd, "buffer = ltt_reserve_slot(trace, ltt_buf,\n"); print_tabs(3, fd); - fprintf(fd, "reserve_size, &slot_size, &tsc,\n"); - print_tabs(3, fd); - fprintf(fd, "&before_hdr_pad, &after_hdr_pad, &header_size);\n"); + fprintf(fd, "reserve_size, &slot_size, &tsc);\n"); /* If error, return */ print_tabs(2, fd); fprintf(fd, "if (!buffer)\n"); @@ -2119,15 +2117,12 @@ int print_event_logging_function_user_fast(char *basename, facility_t *fac, /* Write event header */ print_tabs(2, fd); - fprintf(fd, "ltt_write_event_header(trace, ltt_buf, buffer,\n"); + fprintf(fd, "buffer = ltt_write_event_header(trace, ltt_buf, buffer,\n"); print_tabs(3, fd); fprintf(fd, "ltt_facility_%s_%X, event_%s_%s,\n", fac->name, fac->checksum, fac->name, event->name); print_tabs(3, fd); - fprintf(fd, "reserve_size, before_hdr_pad, tsc);\n"); - print_tabs(2, fd); - fprintf(fd, "*to_base += before_hdr_pad + after_hdr_pad + header_size;\n"); - fprintf(fd, "\n"); + fprintf(fd, "reserve_size, tsc);\n"); /* write data. */ @@ -2551,6 +2546,8 @@ int print_loader_header(facility_t *fac) fprintf(fd,"ltt_facility_t\tltt_facility_%s;\n", fac->name); fprintf(fd,"ltt_facility_t\tltt_facility_%s_%X;\n\n", fac->name, fac->checksum); + fprintf(fd,"extern unsigned int ltt_get_channel_index_%s(u8 eID);\n\n", + fac->name); fprintf(fd,"#define LTT_FACILITY_SYMBOL\t\tltt_facility_%s\n", fac->name); @@ -2562,6 +2559,8 @@ int print_loader_header(facility_t *fac) fac->name); fprintf(fd,"#define LTT_FACILITY_ALIGNMENT\t\t%u\n\n", fac->align); + fprintf(fd,"#define LTT_FACILITY_SELECT\t\tltt_get_channel_index_%s\n\n", + fac->name); fprintf(fd, "#endif //CONFIG_LTT\n\n"); fprintf(fd, "#endif //_LTT_FACILITY_LOADER_%s_H_\n", fac->capname); @@ -2708,6 +2707,7 @@ int print_loader_c(facility_t *fac) fprintf(fd, "\t.checksum = LTT_FACILITY_CHECKSUM,\n"); fprintf(fd, "\t.symbol = SYMBOL_STRING(LTT_FACILITY_SYMBOL),\n"); fprintf(fd, "\t.alignment = LTT_FACILITY_ALIGNMENT,\n"); + fprintf(fd, "\t.select = LTT_FACILITY_SELECT,\n"); fprintf(fd, "};\n"); fprintf(fd, "\n"); fprintf(fd, "static int __init facility_init(void)\n");