Commit 3989bbf9 authored by Leo Yan's avatar Leo Yan Committed by Arnaldo Carvalho de Melo

perf tests tsc: Make tsc testing as a common testing

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: default avatarLeo Yan <leo.yan@linaro.org>
Acked-by: default avatarJiri Olsa <jolsa@redhat.com>
Tested-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
Link: https://lore.kernel.org/r/20201019100236.23675-2-leo.yan@linaro.orgSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
parent 0ee281e1
...@@ -7,7 +7,6 @@ struct test; ...@@ -7,7 +7,6 @@ struct test;
/* Tests */ /* Tests */
int test__rdpmc(struct test *test __maybe_unused, int subtest); 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__insn_x86(struct test *test __maybe_unused, int subtest);
int test__intel_pt_pkt_decoder(struct test *test, int subtest); int test__intel_pt_pkt_decoder(struct test *test, int subtest);
int test__bp_modify(struct test *test, int subtest); int test__bp_modify(struct test *test, int subtest);
......
...@@ -3,6 +3,5 @@ perf-$(CONFIG_DWARF_UNWIND) += dwarf-unwind.o ...@@ -3,6 +3,5 @@ perf-$(CONFIG_DWARF_UNWIND) += dwarf-unwind.o
perf-y += arch-tests.o perf-y += arch-tests.o
perf-y += rdpmc.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_AUXTRACE) += insn-x86.o intel-pt-pkt-decoder-test.o
perf-$(CONFIG_X86_64) += bp-modify.o perf-$(CONFIG_X86_64) += bp-modify.o
...@@ -8,10 +8,6 @@ struct test arch_tests[] = { ...@@ -8,10 +8,6 @@ struct test arch_tests[] = {
.desc = "x86 rdpmc", .desc = "x86 rdpmc",
.func = test__rdpmc, .func = test__rdpmc,
}, },
{
.desc = "Convert perf time to TSC",
.func = test__perf_time_to_tsc,
},
#ifdef HAVE_DWARF_UNWIND_SUPPORT #ifdef HAVE_DWARF_UNWIND_SUPPORT
{ {
.desc = "DWARF unwind", .desc = "DWARF unwind",
......
...@@ -62,6 +62,7 @@ perf-y += pfm.o ...@@ -62,6 +62,7 @@ perf-y += pfm.o
perf-y += parse-metric.o perf-y += parse-metric.o
perf-y += pe-file-parsing.o perf-y += pe-file-parsing.o
perf-y += expand-cgroup.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 $(OUTPUT)tests/llvm-src-base.c: tests/bpf-script-example.c tests/Build
$(call rule_mkdir) $(call rule_mkdir)
......
...@@ -349,6 +349,10 @@ static struct test generic_tests[] = { ...@@ -349,6 +349,10 @@ static struct test generic_tests[] = {
.desc = "Event expansion for cgroups", .desc = "Event expansion for cgroups",
.func = test__expand_cgroup_events, .func = test__expand_cgroup_events,
}, },
{
.desc = "Convert perf time to TSC",
.func = test__perf_time_to_tsc,
},
{ {
.func = NULL, .func = NULL,
}, },
......
...@@ -18,10 +18,8 @@ ...@@ -18,10 +18,8 @@
#include "thread_map.h" #include "thread_map.h"
#include "record.h" #include "record.h"
#include "tsc.h" #include "tsc.h"
#include "util/mmap.h" #include "mmap.h"
#include "tests/tests.h" #include "tests.h"
#include "arch-tests.h"
#define CHECK__(x) { \ #define CHECK__(x) { \
while ((x) < 0) { \ while ((x) < 0) { \
......
...@@ -124,6 +124,7 @@ int test__pfm_subtest_get_nr(void); ...@@ -124,6 +124,7 @@ int test__pfm_subtest_get_nr(void);
int test__parse_metric(struct test *test, int subtest); int test__parse_metric(struct test *test, int subtest);
int test__pe_file_parsing(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__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_signal_is_supported(void);
bool test__bp_account_is_supported(void); bool test__bp_account_is_supported(void);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment