]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
perf tests tsc: Make tsc testing as a common testing
authorLeo Yan <leo.yan@linaro.org>
Mon, 19 Oct 2020 10:02:35 +0000 (18:02 +0800)
committerArnaldo Carvalho de Melo <acme@redhat.com>
Wed, 4 Nov 2020 12:42:40 +0000 (09:42 -0300)
x86 arch provides the testing for conversion between tsc and perf time,
the testing is located in x86 arch folder.  Move this testing out from
x86 arch folder and place it into the common testing folder, so allows
to execute tsc testing on other architectures (e.g. Arm64).

This patch removes the inclusion of "arch-tests.h" from the testing
code, this can avoid building failure if any arch has no this header
file.

Committer testing:

  $ perf test -v tsc
  Couldn't bump rlimit(MEMLOCK), failures may take place when creating BPF maps, etc
  70: Convert perf time to TSC                                        :
  --- start ---
  test child forked, pid 4032834
  mmap size 528384B
  1st event perf time 165409788843605 tsc 336578703793868
  rdtsc          time 165409788854986 tsc 336578703837038
  2nd event perf time 165409788855487 tsc 336578703838935
  test child finished with 0
  ---- end ----
  Convert perf time to TSC: Ok
  $

Signed-off-by: Leo Yan <leo.yan@linaro.org>
Acked-by: Jiri Olsa <jolsa@redhat.com>
Tested-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Link: https://lore.kernel.org/r/20201019100236.23675-2-leo.yan@linaro.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
tools/perf/arch/x86/include/arch-tests.h
tools/perf/arch/x86/tests/Build
tools/perf/arch/x86/tests/arch-tests.c
tools/perf/tests/Build
tools/perf/tests/builtin-test.c
tools/perf/tests/perf-time-to-tsc.c [moved from tools/perf/arch/x86/tests/perf-time-to-tsc.c with 98% similarity]
tools/perf/tests/tests.h

index c41c5affe4be7744c4404b273b0853348cfc69fa..6a54b94f1c25b4c2798861e9662e0c957b4d5ce9 100644 (file)
@@ -7,7 +7,6 @@ struct test;
 
 /* Tests */
 int test__rdpmc(struct test *test __maybe_unused, int subtest);
-int test__perf_time_to_tsc(struct test *test __maybe_unused, int subtest);
 int test__insn_x86(struct test *test __maybe_unused, int subtest);
 int test__intel_pt_pkt_decoder(struct test *test, int subtest);
 int test__bp_modify(struct test *test, int subtest);
index 2997c506550c1330fb2af4b0d42dd74137f0b42d..36d4f248b51dbceda1364767b6949fe720cd6770 100644 (file)
@@ -3,6 +3,5 @@ perf-$(CONFIG_DWARF_UNWIND) += dwarf-unwind.o
 
 perf-y += arch-tests.o
 perf-y += rdpmc.o
-perf-y += perf-time-to-tsc.o
 perf-$(CONFIG_AUXTRACE) += insn-x86.o intel-pt-pkt-decoder-test.o
 perf-$(CONFIG_X86_64) += bp-modify.o
index 6763135aec17b2712199d3573d111bf364a9df50..bc25d727b4e9af4be2b2d360b928d9ab01fca7ae 100644 (file)
@@ -8,10 +8,6 @@ struct test arch_tests[] = {
                .desc = "x86 rdpmc",
                .func = test__rdpmc,
        },
-       {
-               .desc = "Convert perf time to TSC",
-               .func = test__perf_time_to_tsc,
-       },
 #ifdef HAVE_DWARF_UNWIND_SUPPORT
        {
                .desc = "DWARF unwind",
index 4d15bf6041fb9520961d5340114089f23f13bcd8..aa4dc4f5abde0b5c5be5724939fb2e47cf8fcef3 100644 (file)
@@ -62,6 +62,7 @@ perf-y += pfm.o
 perf-y += parse-metric.o
 perf-y += pe-file-parsing.o
 perf-y += expand-cgroup.o
+perf-y += perf-time-to-tsc.o
 
 $(OUTPUT)tests/llvm-src-base.c: tests/bpf-script-example.c tests/Build
        $(call rule_mkdir)
index 132bdb3e6c31a0cb4e4d668b10445d992c92484b..02e7bbf70419aedd420056e0f519a12687b43e3e 100644 (file)
@@ -349,6 +349,10 @@ static struct test generic_tests[] = {
                .desc = "Event expansion for cgroups",
                .func = test__expand_cgroup_events,
        },
+       {
+               .desc = "Convert perf time to TSC",
+               .func = test__perf_time_to_tsc,
+       },
        {
                .func = NULL,
        },
similarity index 98%
rename from tools/perf/arch/x86/tests/perf-time-to-tsc.c
rename to tools/perf/tests/perf-time-to-tsc.c
index 026d32ed078e6e436c743ba008831ed9958ae6a1..aee97c16c0d9b973a843c761ca513a316ab13c7f 100644 (file)
 #include "thread_map.h"
 #include "record.h"
 #include "tsc.h"
-#include "util/mmap.h"
-#include "tests/tests.h"
-
-#include "arch-tests.h"
+#include "mmap.h"
+#include "tests.h"
 
 #define CHECK__(x) {                           \
        while ((x) < 0) {                       \
index c85a2c08e40720f9da1c5f4ba4d2e95220db9bba..c9b180e640e5f21cd5c75e4a42d1f3d38bb206d6 100644 (file)
@@ -124,6 +124,7 @@ int test__pfm_subtest_get_nr(void);
 int test__parse_metric(struct test *test, int subtest);
 int test__pe_file_parsing(struct test *test, int subtest);
 int test__expand_cgroup_events(struct test *test, int subtest);
+int test__perf_time_to_tsc(struct test *test, int subtest);
 
 bool test__bp_signal_is_supported(void);
 bool test__bp_account_is_supported(void);