From mboxrd@z Thu Jan 1 00:00:00 1970 From: Steven Rostedt Subject: Re: [PATCH net-next] net: add network device notifier trace points Date: Wed, 19 Dec 2018 10:51:04 -0500 Message-ID: <20181219105104.3dac1d7f@gandalf.local.home> References: <20181219022706.10611-1-sthemmin@microsoft.com> <20181219083643.7f724e59@redhat.com> Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Cc: Stephen Hemminger , netdev@vger.kernel.org, Stephen Hemminger , Daniel Borkmann , Alexei Starovoitov , Arnaldo Carvalho de Melo To: Jesper Dangaard Brouer Return-path: Received: from mail.kernel.org ([198.145.29.99]:38252 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727310AbeLSPvH (ORCPT ); Wed, 19 Dec 2018 10:51:07 -0500 In-Reply-To: <20181219083643.7f724e59@redhat.com> Sender: netdev-owner@vger.kernel.org List-ID: On Wed, 19 Dec 2018 08:36:43 +0100 Jesper Dangaard Brouer wrote: > > +TRACE_EVENT(net_dev_notifier_entry, > > + > > + TP_PROTO(const struct netdev_notifier_info *info, unsigned long val), > > + > > + TP_ARGS(info, val), > > + > > + TP_STRUCT__entry( > > + __string( name, info->dev->name ) > > + __field( enum netdev_cmd, event ) > > + ), > > + > > + TP_fast_assign( > > + __assign_str(name, info->dev->name); > > + __entry->event = val; > > + ), > > These __string and __assign_str are costly and behind the scenes does a > strcpy. True. But you could also make this into a memcpy with: __array( char, name, IFNAMSIZ) And in TP_fast_assign: memcpy(__entry->name, info->dev->name, IFNAMSIZ); And for the TP_printk: "dev=%s", __entry->name Yes, ifindex is still faster, but this does give you the name in a way that I think even BPF can use it. I also believe that memcopy on a constant is faster than a strcpy. -- Steve