Skip to content

Commit

Permalink
perf tests: Move x86 tests into arch directory
Browse files Browse the repository at this point in the history
Move out the x86-specific tests into tools/perf/arch/x86/tests and
define an 'arch_tests' array, which is the list of tests that only apply
to the build architecture.

We can also now begin to get rid of some of the #ifdef code that is
present in the generic perf tests.

Signed-off-by: Matt Fleming <matt.fleming@intel.com>
Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: Andi Kleen <ak@linux.intel.com>
Cc: Fenghua Yu <fenghua.yu@intel.com>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Kanaka Juvva <kanaka.d.juvva@intel.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Vikas Shivappa <vikas.shivappa@intel.com>
Cc: Vince Weaver <vince@deater.net>
Link: http://lkml.kernel.org/n/tip-9s68h4ptg06ah0lgnjz55mqn@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
  • Loading branch information
Matt Fleming authored and Arnaldo Carvalho de Melo committed Oct 5, 2015
1 parent 31b6753 commit d8b167f
Show file tree
Hide file tree
Showing 16 changed files with 48 additions and 45 deletions.
12 changes: 12 additions & 0 deletions tools/perf/arch/x86/include/arch-tests.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,18 @@
#ifndef ARCH_TESTS_H
#define ARCH_TESTS_H

/* Tests */
int test__rdpmc(void);
int test__perf_time_to_tsc(void);
int test__insn_x86(void);

#ifdef HAVE_DWARF_UNWIND_SUPPORT
struct thread;
struct perf_sample;
int test__arch_unwind_sample(struct perf_sample *sample,
struct thread *thread);
#endif

extern struct test arch_tests[];

#endif
3 changes: 3 additions & 0 deletions tools/perf/arch/x86/tests/Build
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,6 @@ libperf-$(CONFIG_DWARF_UNWIND) += regs_load.o
libperf-$(CONFIG_DWARF_UNWIND) += dwarf-unwind.o

libperf-y += arch-tests.o
libperf-y += rdpmc.o
libperf-y += perf-time-to-tsc.o
libperf-$(CONFIG_AUXTRACE) += insn-x86.o
20 changes: 20 additions & 0 deletions tools/perf/arch/x86/tests/arch-tests.c
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,26 @@
#include "arch-tests.h"

struct test arch_tests[] = {
{
.desc = "x86 rdpmc test",
.func = test__rdpmc,
},
{
.desc = "Test converting perf time to TSC",
.func = test__perf_time_to_tsc,
},
#ifdef HAVE_DWARF_UNWIND_SUPPORT
{
.desc = "Test dwarf unwind",
.func = test__dwarf_unwind,
},
#endif
#ifdef HAVE_AUXTRACE_SUPPORT
{
.desc = "Test x86 instruction decoder - new instructions",
.func = test__insn_x86,
},
#endif
{
.func = NULL,
},
Expand Down
1 change: 1 addition & 0 deletions tools/perf/arch/x86/tests/dwarf-unwind.c
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
#include "event.h"
#include "debug.h"
#include "tests/tests.h"
#include "arch-tests.h"

#define STACK_SIZE 8192

Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
#include <linux/types.h>

#include "debug.h"
#include "tests.h"
#include "tests/tests.h"
#include "arch-tests.h"

#include "intel-pt-decoder/insn.h"
#include "intel-pt-decoder/intel-pt-insn-decoder.h"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,9 @@
#include "thread_map.h"
#include "cpumap.h"
#include "tsc.h"
#include "tests.h"
#include "tests/tests.h"

#include "arch-tests.h"

#define CHECK__(x) { \
while ((x) < 0) { \
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,9 @@
#include <linux/types.h>
#include "perf.h"
#include "debug.h"
#include "tests.h"
#include "tests/tests.h"
#include "cloexec.h"

#if defined(__x86_64__) || defined(__i386__)
#include "arch-tests.h"

static u64 rdpmc(unsigned int counter)
{
Expand Down Expand Up @@ -173,5 +172,3 @@ int test__rdpmc(void)

return 0;
}

#endif
6 changes: 0 additions & 6 deletions tools/perf/tests/Build
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ perf-y += openat-syscall-all-cpus.o
perf-y += openat-syscall-tp-fields.o
perf-y += mmap-basic.o
perf-y += perf-record.o
perf-y += rdpmc.o
perf-y += evsel-roundtrip-name.o
perf-y += evsel-tp-sched.o
perf-y += fdarray.o
Expand All @@ -35,11 +34,6 @@ perf-y += thread-map.o
perf-y += llvm.o
perf-y += topology.o

perf-$(CONFIG_X86) += perf-time-to-tsc.o
ifdef CONFIG_AUXTRACE
perf-$(CONFIG_X86) += insn-x86.o
endif

ifeq ($(ARCH),$(filter $(ARCH),x86 arm arm64))
perf-$(CONFIG_DWARF_UNWIND) += dwarf-unwind.o
endif
Expand Down
28 changes: 0 additions & 28 deletions tools/perf/tests/builtin-test.c
Original file line number Diff line number Diff line change
Expand Up @@ -41,12 +41,6 @@ static struct test generic_tests[] = {
.desc = "parse events tests",
.func = test__parse_events,
},
#if defined(__x86_64__) || defined(__i386__)
{
.desc = "x86 rdpmc test",
.func = test__rdpmc,
},
#endif
{
.desc = "Validate PERF_RECORD_* events & perf_sample fields",
.func = test__PERF_RECORD,
Expand Down Expand Up @@ -107,12 +101,6 @@ static struct test generic_tests[] = {
.desc = "Test software clock events have valid period values",
.func = test__sw_clock_freq,
},
#if defined(__x86_64__) || defined(__i386__)
{
.desc = "Test converting perf time to TSC",
.func = test__perf_time_to_tsc,
},
#endif
{
.desc = "Test object code reading",
.func = test__code_reading,
Expand All @@ -129,14 +117,6 @@ static struct test generic_tests[] = {
.desc = "Test parsing with no sample_id_all bit set",
.func = test__parse_no_sample_id_all,
},
#if defined(__x86_64__) || defined(__i386__) || defined(__arm__) || defined(__aarch64__)
#ifdef HAVE_DWARF_UNWIND_SUPPORT
{
.desc = "Test dwarf unwind",
.func = test__dwarf_unwind,
},
#endif
#endif
{
.desc = "Test filtering hist entries",
.func = test__hists_filter,
Expand Down Expand Up @@ -181,14 +161,6 @@ static struct test generic_tests[] = {
.desc = "Test LLVM searching and compiling",
.func = test__llvm,
},
#ifdef HAVE_AUXTRACE_SUPPORT
#if defined(__x86_64__) || defined(__i386__)
{
.desc = "Test x86 instruction decoder - new instructions",
.func = test__insn_x86,
},
#endif
#endif
{
.desc = "Test topology in session",
.func = test_session_topology,
Expand Down
4 changes: 4 additions & 0 deletions tools/perf/tests/dwarf-unwind.c
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,10 @@
#include "thread.h"
#include "callchain.h"

#if defined (__x86_64__) || defined (__i386__)
#include "arch-tests.h"
#endif

/* For bsearch. We try to unwind functions in shared object. */
#include <stdlib.h>

Expand Down
5 changes: 1 addition & 4 deletions tools/perf/tests/tests.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ int test__openat_syscall_event(void);
int test__openat_syscall_event_on_all_cpus(void);
int test__basic_mmap(void);
int test__PERF_RECORD(void);
int test__rdpmc(void);
int test__perf_evsel__roundtrip_name_test(void);
int test__perf_evsel__tp_sched_test(void);
int test__syscall_openat_tp_fields(void);
Expand All @@ -51,7 +50,6 @@ int test__bp_signal(void);
int test__bp_signal_overflow(void);
int test__task_exit(void);
int test__sw_clock_freq(void);
int test__perf_time_to_tsc(void);
int test__code_reading(void);
int test__sample_parsing(void);
int test__keep_tracking(void);
Expand All @@ -68,10 +66,9 @@ int test__fdarray__add(void);
int test__kmod_path__parse(void);
int test__thread_map(void);
int test__llvm(void);
int test__insn_x86(void);
int test_session_topology(void);

#if defined(__x86_64__) || defined(__i386__) || defined(__arm__) || defined(__aarch64__)
#if defined(__arm__) || defined(__aarch64__)
#ifdef HAVE_DWARF_UNWIND_SUPPORT
struct thread;
struct perf_sample;
Expand Down

0 comments on commit d8b167f

Please sign in to comment.