Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1736448

Re: [PATCH 02/16] hyper-v: trace vmbus_on_message()

From Vitaly Kuznetsov <vkuznets@redhat.com>
Newsgroups linux.kernel
Subject Re: [PATCH 02/16] hyper-v: trace vmbus_on_message()
Date 2017-09-21 10:20 +0200
Message-ID <us4Se-6Mz-7@gated-at.bofh.it> (permalink)
References <urQYV-63Y-3@gated-at.bofh.it> <urQYW-63Y-33@gated-at.bofh.it> <urRrX-6fs-15@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


Steven Rostedt <rostedt@goodmis.org> writes:

> On Wed, 20 Sep 2017 19:21:53 +0200
> Vitaly Kuznetsov <vkuznets@redhat.com> wrote:
>
>> diff --git a/drivers/hv/hv_trace.h b/drivers/hv/hv_trace.h
>> index 9a29ef55477d..72911dfc9682 100644
>> --- a/drivers/hv/hv_trace.h
>> +++ b/drivers/hv/hv_trace.h
>> @@ -14,6 +14,14 @@ TRACE_EVENT(vmbus_on_msg_dpc,
>>  	    TP_printk("message %u received", __entry->msgtype)
>>  	);
>>  
>> +TRACE_EVENT(vmbus_on_message,
>> +	    TP_PROTO(const struct vmbus_channel_message_header *hdr),
>> +	    TP_ARGS(hdr),
>> +	    TP_STRUCT__entry(__field(unsigned int, msgtype)),
>> +	    TP_fast_assign(__entry->msgtype = hdr->msgtype),
>> +	    TP_printk("processing message %u", __entry->msgtype)
>> +	);
>
> Whenever you have two trace events with everything the same but the
> TP_printk(), you can save a little space by using DEFINE_EVENT_PRINT()
>
> DECLARE_EVENT_CLASS(vmbus_hdr_msg,
> 	TP_PROTO(const struct vmbus_channel_message_header *hdr),
> 	TP_ARGS(hdr),
> 	TP_STRUCT__entry(__field(unsigned int, msgtype),
> 	TP_fast_assign(__entry->msg = hdr->msgtype;),
> 	TP_printk("msgtype=%d", __entry->msgtype)
> );
>
> DEFINE_EVENT_PRINT(vmbus_hdr_msg, vmbus_on_msg_dpc,
> 	TP_PROTO(const struct vmbus_channel_message_header *hdr),
> 	TP_ARGS(hdr),
> 	TP_printk("message %u received", __entry->msgtype));
>
> DEFINE_EVENT_PRINT(vmbus_hdr_msg, vmbus_on_message,
> 	TP_PROTO(const struct vmbus_channel_message_header *hdr),
> 	TP_ARGS(hdr),
> 	TP_printk("processing message %u", __entry->msgtype));
>
> This will use the same functions required to save and record the
> message but will use a different function to output it to the trace.

Oh, thanks! This seems to be useful for
vmbus_on_msg_dpc/vmbus_on_message only as all the rest needs to parse
different structures. Will use it in v2.

-- 
  Vitaly

Back to linux.kernel | Previous | NextPrevious in thread | Find similar | Unroll thread


Thread

[PATCH 02/16] hyper-v: trace vmbus_on_message() Vitaly Kuznetsov <vkuznets@redhat.com> - 2017-09-20 19:30 +0200
  Re: [PATCH 02/16] hyper-v: trace vmbus_on_message() Steven Rostedt <rostedt@goodmis.org> - 2017-09-20 20:00 +0200
    Re: [PATCH 02/16] hyper-v: trace vmbus_on_message() Vitaly Kuznetsov <vkuznets@redhat.com> - 2017-09-21 10:20 +0200

csiph-web