在 2020/9/22 上午5:40, Andrii Nakryiko 写道:
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?
Yes
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.
Thanks, i will change it.
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.
There no copyright, it follow dual-licensed as (LGPL-2.1 OR BSD-2-Clause)
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?
Ok, thanks
I've also CC'ed original author (Wenbo Zhang), just for visibility.
Thanks
+#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.
I do not chang any codes, That's what the original code looks like
+
[...]
--
Best Regards!
Xin Hao