OSDN Git Service

Merge tag 'perf-tools-for-v5.18-2022-03-26' of git://git.kernel.org/pub/scm/linux...
[uclinux-h8/linux.git] / tools / perf / builtin-c2c.c
index 77dd4af..fbbed43 100644 (file)
@@ -44,6 +44,7 @@
 #include "../perf.h"
 #include "pmu.h"
 #include "pmu-hybrid.h"
+#include "string2.h"
 
 struct c2c_hists {
        struct hists            hists;
@@ -1080,7 +1081,7 @@ node_entry(struct perf_hpp_fmt *fmt __maybe_unused, struct perf_hpp *hpp,
                bitmap_zero(set, c2c.cpus_cnt);
                bitmap_and(set, c2c_he->cpuset, c2c.nodes[node], c2c.cpus_cnt);
 
-               if (!bitmap_weight(set, c2c.cpus_cnt)) {
+               if (bitmap_empty(set, c2c.cpus_cnt)) {
                        if (c2c.node_info == 1) {
                                ret = scnprintf(hpp->buf, hpp->size, "%21s", " ");
                                advance_hpp(hpp, ret);
@@ -1944,7 +1945,7 @@ static int set_nodestr(struct c2c_hist_entry *c2c_he)
        if (c2c_he->nodestr)
                return 0;
 
-       if (bitmap_weight(c2c_he->nodeset, c2c.nodes_cnt)) {
+       if (!bitmap_empty(c2c_he->nodeset, c2c.nodes_cnt)) {
                len = bitmap_scnprintf(c2c_he->nodeset, c2c.nodes_cnt,
                                      buf, sizeof(buf));
        } else {
@@ -3025,9 +3026,9 @@ int cmd_c2c(int argc, const char **argv)
        if (!argc)
                usage_with_options(c2c_usage, c2c_options);
 
-       if (!strncmp(argv[0], "rec", 3)) {
+       if (strlen(argv[0]) > 2 && strstarts("record", argv[0])) {
                return perf_c2c__record(argc, argv);
-       } else if (!strncmp(argv[0], "rep", 3)) {
+       } else if (strlen(argv[0]) > 2 && strstarts("report", argv[0])) {
                return perf_c2c__report(argc, argv);
        } else {
                usage_with_options(c2c_usage, c2c_options);