Commit b13fa914 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/jolsa/perf

 into perf/core

Pull perf/core improvements and fixes from Jiri Olsa:

  * Warn the user when trace command is not available (Arnaldo Carvalho de Melo)

  * Add warning when disabling perl scripting support due to missing devel files (Arnaldo Carvalho de Melo)

  * Consider header files outside perf directory in tags target (Sebastian Andrzej Siewior)

  * Allow overriding sysfs and proc finding with env var (Cody P Schafer)

  * Fix "==" into "=" in ui_browser__warning assignment (zhangdianfang)

  * Factor elide bool handling in sort code (Jiri Olsa)

  * Fix poll return value propagation (Jiri Olsa)

  * Fix 'make help' message error (Jianyu Zhan)

Signed-off-by: default avatarJiri Olsa <jolsa@kernel.org>
Signed-off-by: default avatarIngo Molnar <mingo@kernel.org>
parents 9b261365 fc9cabea
Loading
Loading
Loading
Loading
+42 −1
Original line number Diff line number Diff line
/* TODO merge/factor in debugfs.c here */

#include <ctype.h>
#include <errno.h>
#include <stdbool.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/vfs.h>

@@ -96,12 +98,51 @@ static bool fs__check_mounts(struct fs *fs)
	return false;
}

static void mem_toupper(char *f, size_t len)
{
	while (len) {
		*f = toupper(*f);
		f++;
		len--;
	}
}

/*
 * Check for "NAME_PATH" environment variable to override fs location (for
 * testing). This matches the recommendation in Documentation/sysfs-rules.txt
 * for SYSFS_PATH.
 */
static bool fs__env_override(struct fs *fs)
{
	char *override_path;
	size_t name_len = strlen(fs->name);
	/* name + "_PATH" + '\0' */
	char upper_name[name_len + 5 + 1];
	memcpy(upper_name, fs->name, name_len);
	mem_toupper(upper_name, name_len);
	strcpy(&upper_name[name_len], "_PATH");

	override_path = getenv(upper_name);
	if (!override_path)
		return false;

	fs->found = true;
	strncpy(fs->path, override_path, sizeof(fs->path));
	return true;
}

static const char *fs__get_mountpoint(struct fs *fs)
{
	if (fs__env_override(fs))
		return fs->path;

	if (fs__check_mounts(fs))
		return fs->path;

	return fs__read_mounts(fs) ? fs->path : NULL;
	if (fs__read_mounts(fs))
		return fs->path;

	return NULL;
}

static const char *fs__mountpoint(int idx)
+8 −5
Original line number Diff line number Diff line
@@ -789,8 +789,8 @@ help:
	@echo ''
	@echo 'Perf install targets:'
	@echo '  NOTE: documentation build requires asciidoc, xmlto packages to be installed'
	@echo '  HINT: use "make prefix=<path> <install target>" to install to a particular'
	@echo '        path like make prefix=/usr/local install install-doc'
	@echo '  HINT: use "prefix" or "DESTDIR" to install to a particular'
	@echo '        path like "make prefix=/usr/local install install-doc"'
	@echo '  install	- install compiled binaries'
	@echo '  install-doc	- install *all* documentation'
	@echo '  install-man	- install manpage documentation'
@@ -815,17 +815,20 @@ INSTALL_DOC_TARGETS += quick-install-doc quick-install-man quick-install-html
$(DOC_TARGETS):
	$(QUIET_SUBDIR0)Documentation $(QUIET_SUBDIR1) $(@:doc=all)

TAG_FOLDERS= . ../lib/traceevent ../lib/api ../lib/symbol
TAG_FILES= ../../include/uapi/linux/perf_event.h

TAGS:
	$(RM) TAGS
	$(FIND) . -name '*.[hcS]' -print | xargs etags -a
	$(FIND) $(TAG_FOLDERS) -name '*.[hcS]' -print | xargs etags -a $(TAG_FILES)

tags:
	$(RM) tags
	$(FIND) . -name '*.[hcS]' -print | xargs ctags -a
	$(FIND) $(TAG_FOLDERS) -name '*.[hcS]' -print | xargs ctags -a $(TAG_FILES)

cscope:
	$(RM) cscope*
	$(FIND) . -name '*.[hcS]' -print | xargs cscope -b
	$(FIND) $(TAG_FOLDERS) -name '*.[hcS]' -print | xargs cscope -b $(TAG_FILES)

### Detect prefix changes
TRACK_CFLAGS = $(subst ','\'',$(CFLAGS)):\
+5 −1
Original line number Diff line number Diff line
@@ -454,7 +454,11 @@ static int __cmd_record(struct record *rec, int argc, const char **argv)
			if (done)
				break;
			err = poll(rec->evlist->pollfd, rec->evlist->nr_fds, -1);
			if (err < 0 && errno == EINTR)
			/*
			 * Propagate error, only if there's any. Ignore positive
			 * number of returned events and interrupt error.
			 */
			if (err > 0 || (err < 0 && errno == EINTR))
				err = 0;
			waking++;
		}
+2 −1
Original line number Diff line number Diff line
@@ -447,6 +447,7 @@ else
  ifneq ($(feature-libperl), 1)
    CFLAGS += -DNO_LIBPERL
    NO_LIBPERL := 1
    msg := $(warning Missing perl devel files. Disabling perl scripting support, consider installing perl-ExtUtils-Embed);
  else
    LDFLAGS += $(PERL_EMBED_LDFLAGS)
    EXTLIBS += $(PERL_EMBED_LIBADD)
@@ -599,7 +600,7 @@ endif

# Make the path relative to DESTDIR, not to prefix
ifndef DESTDIR
prefix = $(HOME)
prefix ?= $(HOME)
endif
bindir_relative = bin
bindir = $(prefix)/$(bindir_relative)
+6 −2
Original line number Diff line number Diff line
@@ -481,14 +481,18 @@ int main(int argc, const char **argv)
		fprintf(stderr, "cannot handle %s internally", cmd);
		goto out;
	}
#ifdef HAVE_LIBAUDIT_SUPPORT
	if (!prefixcmp(cmd, "trace")) {
#ifdef HAVE_LIBAUDIT_SUPPORT
		set_buildid_dir();
		setup_path();
		argv[0] = "trace";
		return cmd_trace(argc, argv, NULL);
	}
#else
		fprintf(stderr,
			"trace command not available: missing audit-libs devel package at build time.\n");
		goto out;
#endif
	}
	/* Look for flags.. */
	argv++;
	argc--;
Loading