Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 0a119538 authored by Ingo Molnar's avatar Ingo Molnar
Browse files

Merge tag 'perf-core-for-mingo' of...

Merge tag 'perf-core-for-mingo' of git://git.kernel.org/pub/scm/linux/kernel/git/acme/linux

 into perf/core

Conflicts:
	tools/Makefile

Pull perf/core improvements and fixes from Arnaldo Carvalho de Melo:

. Honor parallel jobs, fix from Borislav Petkov

. Introduce tools/lib/lk library, initially just removing duplication
  among tools/perf and tools/vm. from Borislav Petkov

. Fix build on non-glibc systems due to libio.h absence, from Cody P Schafer.

. Remove some perf_session and tracing dead code, from David Ahern.

. Introduce perf stat --repeat forever, from Frederik Deweerdt.

. Add perf test entries for checking --cpu in record and stat, from Jiri Olsa.

. Add perf test entries for checking breakpoint overflow signal handler issues,
  from Jiri Olsa.

. Add perf test entry for for checking number of EXIT events, from Namhyung Kim.

. Simplify some perf_evlist methods and to allow 'stat' to share code with
  'record' and 'trace'.

. Remove dead code in related to libtraceevent integration, from Namhyung Kim.

. Event group view for 'annotate' in --stdio, --tui and --gtk, from Namhyung Kim.

Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
[ resolved the trivial merge conflict with upstream ]
Signed-off-by: default avatarIngo Molnar <mingo@kernel.org>
parents 3bf23917 bc96b361
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -1331,11 +1331,11 @@ kernelversion:
# Clear a bunch of variables before executing the submake
tools/: FORCE
	$(Q)mkdir -p $(objtree)/tools
	$(Q)$(MAKE) LDFLAGS= MAKEFLAGS= O=$(objtree) subdir=tools -C $(src)/tools/
	$(Q)$(MAKE) LDFLAGS= MAKEFLAGS="$(filter --j% -j,$(MAKEFLAGS))" O=$(objtree) subdir=tools -C $(src)/tools/

tools/%: FORCE
	$(Q)mkdir -p $(objtree)/tools
	$(Q)$(MAKE) LDFLAGS= MAKEFLAGS= O=$(objtree) subdir=tools -C $(src)/tools/ $*
	$(Q)$(MAKE) LDFLAGS= MAKEFLAGS="$(filter --j% -j,$(MAKEFLAGS))" O=$(objtree) subdir=tools -C $(src)/tools/ $*

# Single targets
# ---------------------------------------------------------------------------
+14 −2
Original line number Diff line number Diff line
@@ -34,7 +34,13 @@ help:
cpupower: FORCE
	$(call descend,power/$@)

cgroup firewire lguest perf usb virtio vm: FORCE
cgroup firewire guest usb virtio vm: FORCE
	$(call descend,$@)

liblk: FORCE
	$(call descend,lib/lk)

perf: liblk FORCE
	$(call descend,$@)

selftests: FORCE
@@ -62,7 +68,13 @@ install: cgroup_install cpupower_install firewire_install lguest_install \
cpupower_clean:
	$(call descend,power/cpupower,clean)

cgroup_clean firewire_clean lguest_clean perf_clean usb_clean virtio_clean vm_clean:
cgroup_clean firewire_clean lguest_clean usb_clean virtio_clean vm_clean:
	$(call descend,$(@:_clean=),clean)

liblk_clean:
	$(call descend,lib/lk,clean)

perf_clean: liblk_clean
	$(call descend,$(@:_clean=),clean)

selftests_clean:

tools/lib/lk/Makefile

0 → 100644
+35 −0
Original line number Diff line number Diff line
include ../../scripts/Makefile.include

# guard against environment variables
LIB_H=
LIB_OBJS=

LIB_H += debugfs.h

LIB_OBJS += $(OUTPUT)debugfs.o

LIBFILE = liblk.a

CFLAGS = -ggdb3 -Wall -Wextra -std=gnu99 -Werror -O6 -D_FORTIFY_SOURCE=2 $(EXTRA_WARNINGS) $(EXTRA_CFLAGS) -fPIC
EXTLIBS = -lpthread -lrt -lelf -lm
ALL_CFLAGS = $(CFLAGS) $(BASIC_CFLAGS) -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64
ALL_LDFLAGS = $(LDFLAGS)

RM = rm -f

$(LIBFILE): $(LIB_OBJS)
	$(QUIET_AR)$(RM) $@ && $(AR) rcs $(OUTPUT)$@ $(LIB_OBJS)

$(LIB_OBJS): $(LIB_H)

$(OUTPUT)%.o: %.c
	$(QUIET_CC)$(CC) -o $@ -c $(ALL_CFLAGS) $<
$(OUTPUT)%.s: %.c
	$(QUIET_CC)$(CC) -S $(ALL_CFLAGS) $<
$(OUTPUT)%.o: %.S
	$(QUIET_CC)$(CC) -o $@ -c $(ALL_CFLAGS) $<

clean:
	$(RM) $(LIB_OBJS) $(LIBFILE)

.PHONY: clean
+18 −31
Original line number Diff line number Diff line
#include "util.h"
#include "debugfs.h"
#include "cache.h"

#include <linux/kernel.h>
#include <errno.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <stdbool.h>
#include <sys/vfs.h>
#include <sys/mount.h>
#include <linux/magic.h>
#include <linux/kernel.h>

#include "debugfs.h"

static int debugfs_premounted;
char debugfs_mountpoint[PATH_MAX + 1] = "/sys/kernel/debug";
char tracing_events_path[PATH_MAX + 1] = "/sys/kernel/debug/tracing/events";

static const char *debugfs_known_mountpoints[] = {
static const char * const debugfs_known_mountpoints[] = {
	"/sys/kernel/debug/",
	"/debug/",
	0,
};

static int debugfs_found;
static bool debugfs_found;

/* find the path to the mounted debugfs */
const char *debugfs_find_mountpoint(void)
{
	const char **ptr;
	const char * const *ptr;
	char type[100];
	FILE *fp;

@@ -30,7 +33,7 @@ const char *debugfs_find_mountpoint(void)
	ptr = debugfs_known_mountpoints;
	while (*ptr) {
		if (debugfs_valid_mountpoint(*ptr) == 0) {
			debugfs_found = 1;
			debugfs_found = true;
			strcpy(debugfs_mountpoint, *ptr);
			return debugfs_mountpoint;
		}
@@ -52,7 +55,7 @@ const char *debugfs_find_mountpoint(void)
	if (strcmp(type, "debugfs") != 0)
		return NULL;

	debugfs_found = 1;
	debugfs_found = true;

	return debugfs_mountpoint;
}
@@ -71,21 +74,12 @@ int debugfs_valid_mountpoint(const char *debugfs)
	return 0;
}

static void debugfs_set_tracing_events_path(const char *mountpoint)
{
	snprintf(tracing_events_path, sizeof(tracing_events_path), "%s/%s",
		 mountpoint, "tracing/events");
}

/* mount the debugfs somewhere if it's not mounted */

char *debugfs_mount(const char *mountpoint)
{
	/* see if it's already mounted */
	if (debugfs_find_mountpoint()) {
		debugfs_premounted = 1;
	if (debugfs_find_mountpoint())
		goto out;
	}

	/* if not mounted and no argument */
	if (mountpoint == NULL) {
@@ -100,15 +94,8 @@ char *debugfs_mount(const char *mountpoint)
		return NULL;

	/* save the mountpoint */
	debugfs_found = 1;
	debugfs_found = true;
	strncpy(debugfs_mountpoint, mountpoint, sizeof(debugfs_mountpoint));
out:
	debugfs_set_tracing_events_path(debugfs_mountpoint);
	return debugfs_mountpoint;
}

void debugfs_set_path(const char *mountpoint)
{
	snprintf(debugfs_mountpoint, sizeof(debugfs_mountpoint), "%s", mountpoint);
	debugfs_set_tracing_events_path(mountpoint);
}

tools/lib/lk/debugfs.h

0 → 100644
+29 −0
Original line number Diff line number Diff line
#ifndef __LK_DEBUGFS_H__
#define __LK_DEBUGFS_H__

#define _STR(x) #x
#define STR(x) _STR(x)

/*
 * On most systems <limits.h> would have given us this, but  not on some systems
 * (e.g. GNU/Hurd).
 */
#ifndef PATH_MAX
#define PATH_MAX 4096
#endif

#ifndef DEBUGFS_MAGIC
#define DEBUGFS_MAGIC          0x64626720
#endif

#ifndef PERF_DEBUGFS_ENVIRONMENT
#define PERF_DEBUGFS_ENVIRONMENT "PERF_DEBUGFS_DIR"
#endif

const char *debugfs_find_mountpoint(void);
int debugfs_valid_mountpoint(const char *debugfs);
char *debugfs_mount(const char *mountpoint);

extern char debugfs_mountpoint[];

#endif /* __LK_DEBUGFS_H__ */
Loading