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

Commit 9059b284 authored by Ingo Molnar's avatar Ingo Molnar
Browse files

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

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

 into perf/core

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

User visible changes:

  - Add 'socket' sort entry, to sort by the processor socket in
    'perf top' and 'perf report'. (Kan Liang)

  - Introduce --socket-filter to 'perf report', for filtering by processor
    socket. (Kan Liang)

  - Add new "Zoom into Processor Socket" operation in the perf hists browser,
    used in 'perf top' and 'perf report'. (Kan Liang)

  - Fix the 'CPU' hist browser column width calculation. (Arnaldo Carvalho de Melo)

Infrastructure changes:

  - 'perf test' fixes for the object code reading entry. (Jan Stancek)

  - Add processor socket and cpu topology 'perf test' entries. (Kan Liang)

  - Introduce more sysfs__read_TYPE() helpers. (Arnaldo Carvalho de Melo)

  - Group cpu information reading functions in tools/lib/api/cpu.[ch],
    starting with cpu__get_max_freq() from a patchkit by Kan Liang.
    (Arnaldo Carvalho de Melo)

  - Retrieve the MSR PMU type from a perf.data file header and store it
    in struct perf_env. (Kan Liang)

  - Add tools/include into CTAGS file list. (Jiri Olsa)

  - Add iterator function for perf tests. (Matt Fleming)

  - Switch to tracing_patch interface. (Jiri Olsa)

Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
Signed-off-by: default avatarIngo Molnar <mingo@kernel.org>
parents 8f3e5684 92d424ae
Loading
Loading
Loading
Loading
+1 −0
Original line number Original line Diff line number Diff line
libapi-y += fd/
libapi-y += fd/
libapi-y += fs/
libapi-y += fs/
libapi-y += cpu.o

tools/lib/api/cpu.c

0 → 100644
+18 −0
Original line number Original line Diff line number Diff line
#include <stdio.h>

#include "cpu.h"
#include "fs/fs.h"

int cpu__get_max_freq(unsigned long long *freq)
{
	char entry[PATH_MAX];
	int cpu;

	if (sysfs__read_int("devices/system/cpu/online", &cpu) < 0)
		return -1;

	snprintf(entry, sizeof(entry),
		 "devices/system/cpu/cpu%d/cpufreq/cpuinfo_max_freq", cpu);

	return sysfs__read_ull(entry, freq);
}

tools/lib/api/cpu.h

0 → 100644
+6 −0
Original line number Original line Diff line number Diff line
#ifndef __API_CPU__
#define __API_CPU__

int cpu__get_max_freq(unsigned long long *freq);

#endif /* __API_CPU__ */
+0 −3
Original line number Original line Diff line number Diff line
libapi-y += fs.o
libapi-y += fs.o
libapi-y += tracing_path.o
libapi-y += tracing_path.o
libapi-y += debugfs.o
libapi-y += findfs.o
libapi-y += tracefs.o

tools/lib/api/fs/debugfs.c

deleted100644 → 0
+0 −77
Original line number Original line Diff line number Diff line
#define _GNU_SOURCE
#include <errno.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <stdbool.h>
#include <sys/vfs.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <sys/mount.h>
#include <linux/kernel.h>

#include "debugfs.h"
#include "tracefs.h"

#ifndef DEBUGFS_DEFAULT_PATH
#define DEBUGFS_DEFAULT_PATH		"/sys/kernel/debug"
#endif

char debugfs_mountpoint[PATH_MAX + 1] = DEBUGFS_DEFAULT_PATH;

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

static bool debugfs_found;

bool debugfs_configured(void)
{
	return debugfs_find_mountpoint() != NULL;
}

/* find the path to the mounted debugfs */
const char *debugfs_find_mountpoint(void)
{
	const char *ret;

	if (debugfs_found)
		return (const char *)debugfs_mountpoint;

	ret = find_mountpoint("debugfs", (long) DEBUGFS_MAGIC,
			      debugfs_mountpoint, PATH_MAX + 1,
			      debugfs_known_mountpoints);
	if (ret)
		debugfs_found = true;

	return ret;
}

/* 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())
		goto out;

	/* if not mounted and no argument */
	if (mountpoint == NULL) {
		/* see if environment variable set */
		mountpoint = getenv(PERF_DEBUGFS_ENVIRONMENT);
		/* if no environment variable, use default */
		if (mountpoint == NULL)
			mountpoint = DEBUGFS_DEFAULT_PATH;
	}

	if (mount(NULL, mountpoint, "debugfs", 0, NULL) < 0)
		return NULL;

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