On Mon, Sep 21, 2020 at 10:18 AM John Fastabend <john.fastabend@xxxxxxxxx> wrote: > > Xin Hao wrote: > > The relative functions is copy from bcc tools you probably meant relevant, not relative? > > source code: libbpf-tools/trace_helpers.c. > > URL: https://github.com/iovisor/bcc.git > > > > Log2 histogram can display the change of the collected > > data more conveniently. > > > > Signed-off-by: Xin Hao <xhao@xxxxxxxxxxxxxxxxx> > > --- > > samples/bpf/common.h | 67 ++++++++++++++++++++++++++++++++++++++++++++ > > 1 file changed, 67 insertions(+) > > create mode 100644 samples/bpf/common.h > > > > diff --git a/samples/bpf/common.h b/samples/bpf/common.h > > new file mode 100644 > > index 000000000000..ec60fb665544 > > --- /dev/null > > +++ b/samples/bpf/common.h > > @@ -0,0 +1,67 @@ > > +/* SPDX-License-Identifier: GPL-2.0 > > + * > > + * This program is free software; you can redistribute it and/or > > + * modify it under the terms of version 2 of the GNU General Public > > + * License as published by the Free Software Foundation. > > + */ > > + > > nit, for this patch and the last one we don't need the text. Just the SPDX > identifier should be enough. Its at least in line with everything we have > elsewhere. > > Also if there is a copyright on that original file we should pull it over > as far as I understand it. I don't see anything there though so maybe > not. Original code is dual-licensed as (LGPL-2.1 OR BSD-2-Clause), probably leaving a comment with original location and mentioning the original license would be ok? I've also CC'ed original author (Wenbo Zhang), just for visibility. > > > +#define min(x, y) ({ \ > > + typeof(x) _min1 = (x); \ > > + typeof(y) _min2 = (y); \ > > + (void) (&_min1 == &_min2); \ > > + _min1 < _min2 ? _min1 : _min2; }) > > What was wrong with 'min(a,b) ((a) < (b) ? (a) : (b))' looks like > below its just used for comparing two unsigned ints? > > Thanks. > > > + [...]