Skip to content

Commit fd21834

Browse files
committed
perf beauty: Hook up the x86 MSR table generator
This way we generate the source with the table for later use by plugins, etc. I.e. after running: $ make -C tools/perf O=/tmp/build/perf We end up with: $ head /tmp/build/perf/trace/beauty/generated/x86_arch_MSRs_array.c static const char *x86_MSRs[] = { [0x00000000] = "IA32_P5_MC_ADDR", [0x00000001] = "IA32_P5_MC_TYPE", [0x00000010] = "IA32_TSC", [0x00000017] = "IA32_PLATFORM_ID", [0x0000001b] = "IA32_APICBASE", [0x00000020] = "KNC_PERFCTR0", [0x00000021] = "KNC_PERFCTR1", [0x00000028] = "KNC_EVNTSEL0", [0x00000029] = "KNC_EVNTSEL1", $ Now its just a matter of using it, first in a libtracevent plugin. At some point we should move tools/perf/trace/beauty to tools/beauty/, so that it can be used more generally and even made available externally like libbpf, libperf, libtraevent, etc. Cc: Adrian Hunter <adrian.hunter@intel.com> Cc: Brendan Gregg <brendan.d.gregg@gmail.com> Cc: Jiri Olsa <jolsa@kernel.org> Cc: Luis Cláudio Gonçalves <lclaudio@redhat.com> Cc: Namhyung Kim <namhyung@kernel.org> Link: https://lkml.kernel.org/n/tip-b3rmutg4igcohx6kpo67qh4j@git.kernel.org Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
1 parent 693d345 commit fd21834

1 file changed

Lines changed: 9 additions & 0 deletions

File tree

‎tools/perf/Makefile.perf‎

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -407,6 +407,7 @@ linux_uapi_dir := $(srctree)/tools/include/uapi/linux
407407
asm_generic_uapi_dir := $(srctree)/tools/include/uapi/asm-generic
408408
arch_asm_uapi_dir := $(srctree)/tools/arch/$(SRCARCH)/include/uapi/asm/
409409
x86_arch_asm_uapi_dir := $(srctree)/tools/arch/x86/include/uapi/asm/
410+
x86_arch_asm_dir := $(srctree)/tools/arch/x86/include/asm/
410411

411412
beauty_outdir := $(OUTPUT)trace/beauty/generated
412413
beauty_ioctl_outdir := $(beauty_outdir)/ioctl
@@ -543,6 +544,12 @@ x86_arch_prctl_code_tbl := $(srctree)/tools/perf/trace/beauty/x86_arch_prctl.sh
543544
$(x86_arch_prctl_code_array): $(x86_arch_asm_uapi_dir)/prctl.h $(x86_arch_prctl_code_tbl)
544545
$(Q)$(SHELL) '$(x86_arch_prctl_code_tbl)' $(x86_arch_asm_uapi_dir) > $@
545546

547+
x86_arch_MSRs_array := $(beauty_outdir)/x86_arch_MSRs_array.c
548+
x86_arch_MSRs_tbl := $(srctree)/tools/perf/trace/beauty/tracepoints/x86_msr.sh
549+
550+
$(x86_arch_MSRs_array): $(x86_arch_asm_dir)/msr-index.h $(x86_arch_MSRs_tbl)
551+
$(Q)$(SHELL) '$(x86_arch_MSRs_tbl)' $(x86_arch_asm_dir) > $@
552+
546553
rename_flags_array := $(beauty_outdir)/rename_flags_array.c
547554
rename_flags_tbl := $(srctree)/tools/perf/trace/beauty/rename_flags.sh
548555

@@ -677,6 +684,7 @@ prepare: $(OUTPUT)PERF-VERSION-FILE $(OUTPUT)common-cmds.h archheaders $(drm_ioc
677684
$(perf_ioctl_array) \
678685
$(prctl_option_array) \
679686
$(usbdevfs_ioctl_array) \
687+
$(x86_arch_MSRs_array) \
680688
$(x86_arch_prctl_code_array) \
681689
$(rename_flags_array) \
682690
$(arch_errno_name_array) \
@@ -981,6 +989,7 @@ clean:: $(LIBTRACEEVENT)-clean $(LIBAPI)-clean $(LIBBPF)-clean $(LIBSUBCMD)-clea
981989
$(OUTPUT)$(perf_ioctl_array) \
982990
$(OUTPUT)$(prctl_option_array) \
983991
$(OUTPUT)$(usbdevfs_ioctl_array) \
992+
$(OUTPUT)$(x86_arch_MSRs_array) \
984993
$(OUTPUT)$(x86_arch_prctl_code_array) \
985994
$(OUTPUT)$(rename_flags_array) \
986995
$(OUTPUT)$(arch_errno_name_array) \

0 commit comments

Comments
 (0)