Never re-read length for dynamic arrays
authorMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Wed, 1 Jun 2011 22:47:59 +0000 (18:47 -0400)
committerMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Wed, 1 Jun 2011 22:47:59 +0000 (18:47 -0400)
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
instrumentation/events/lttng-module/block.h
probes/lttng-events.h

index 5ecc95aa6ec2cbebfc62dc1d903f9ba7e93899fe..1d5531c974fae249b0ecd382c7fc7c745667323e 100644 (file)
@@ -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)
        ),
 
index b32921ca67121fb2c3c89654fecebb60ac3ebd0e..8de92ba5ab4854815ab899d431c011fe347710c0 100644 (file)
@@ -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
This page took 0.028928 seconds and 4 git commands to generate.