[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20181219105104.3dac1d7f@gandalf.local.home>
Date:   Wed, 19 Dec 2018 10:51:04 -0500
From:   Steven Rostedt <rostedt@...dmis.org>
To:     Jesper Dangaard Brouer <brouer@...hat.com>
Cc:     Stephen Hemminger <stephen@...workplumber.org>,
        netdev@...r.kernel.org, Stephen Hemminger <sthemmin@...rosoft.com>,
        Daniel Borkmann <borkmann@...earbox.net>,
        Alexei Starovoitov <alexei.starovoitov@...il.com>,
        Arnaldo Carvalho de Melo <acme@...hat.com>
Subject: Re: [PATCH net-next] net: add network device notifier trace points
On Wed, 19 Dec 2018 08:36:43 +0100
Jesper Dangaard Brouer <brouer@...hat.com> 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
Powered by blists - more mailing lists
 
