From: Mathieu Desnoyers Date: Wed, 1 Jun 2011 22:47:59 +0000 (-0400) Subject: Never re-read length for dynamic arrays X-Git-Tag: v2.0-pre1~68 X-Git-Url: https://git.lttng.org./?a=commitdiff_plain;h=41b59694ba5b85708c9b6a68743347388665a5a3;p=lttng-modules.git Never re-read length for dynamic arrays Signed-off-by: Mathieu Desnoyers --- diff --git a/instrumentation/events/lttng-module/block.h b/instrumentation/events/lttng-module/block.h index 5ecc95aa..1d5531c9 100644 --- a/instrumentation/events/lttng-module/block.h +++ b/instrumentation/events/lttng-module/block.h @@ -69,7 +69,7 @@ DECLARE_EVENT_CLASS(block_rq_with_error, 0 : blk_rq_sectors(rq)) tp_assign(errors, rq->errors) blk_fill_rwbs(rwbs, rq->cmd_flags, blk_rq_bytes(rq)) - tp_memcpy_dyn(cmd, rq->cmd, blk_cmd_buf_len(rq)) + tp_memcpy_dyn(cmd, rq->cmd) ), TP_printk("%d,%d %s (%s) %llu + %u [%d]", @@ -157,7 +157,7 @@ DECLARE_EVENT_CLASS(block_rq, tp_assign(bytes, (rq->cmd_type == REQ_TYPE_BLOCK_PC) ? blk_rq_bytes(rq) : 0) blk_fill_rwbs(rwbs, rq->cmd_flags, blk_rq_bytes(rq)) - tp_memcpy_dyn(cmd, rq->cmd, blk_cmd_buf_len(rq)) + tp_memcpy_dyn(cmd, rq->cmd) tp_memcpy(comm, current->comm, TASK_COMM_LEN) ), diff --git a/probes/lttng-events.h b/probes/lttng-events.h index b32921ca..8de92ba5 100644 --- a/probes/lttng-events.h +++ b/probes/lttng-events.h @@ -259,7 +259,9 @@ static struct lttng_probe_desc TP_ID(__probe_desc___, TRACE_SYSTEM) = { __event_len += lib_ring_buffer_align(__event_len, ltt_alignof(u32)); \ __event_len += sizeof(u32); \ __event_len += lib_ring_buffer_align(__event_len, ltt_alignof(_type)); \ - __event_len += sizeof(_type) * (_length); + __dynamic_len[__dynamic_len_idx] = (_length); \ + __event_len += sizeof(_type) * __dynamic_len[__dynamic_len_idx]; \ + __dynamic_len_idx++; #undef __dynamic_array_text #define __dynamic_array_text(_type, _item, _length) \ @@ -461,17 +463,18 @@ __assign_##dest: \ goto __end_field_##dest; #undef tp_memcpy_dyn -#define tp_memcpy_dyn(dest, src, len) \ +#define tp_memcpy_dyn(dest, src) \ __assign_##dest##_1: \ { \ - u32 __tmpl = (len); \ + u32 __tmpl = __dynamic_len[__dynamic_len_idx]; \ lib_ring_buffer_align_ctx(&ctx, ltt_alignof(u32)); \ __chan->ops->event_write(&ctx, &__tmpl, sizeof(u32)); \ } \ goto __end_field_##dest##_1; \ __assign_##dest##_2: \ lib_ring_buffer_align_ctx(&ctx, ltt_alignof(__typemap.dest)); \ - __chan->ops->event_write(&ctx, src, len); \ + __chan->ops->event_write(&ctx, src, \ + sizeof(__typemap.dest) * __get_dynamic_array_len(dest));\ goto __end_field_##dest##_2; #undef tp_strcpy