Merge branch 'perf/core' into perf/probes
Resolved merge conflict in tools/perf/Makefile Merge reason: we want to queue up a dependent patch. Signed-off-by: Ingo Molnar <mingo@elte.hu>
This commit is contained in:
@@ -14,6 +14,7 @@
|
||||
#include "util/run-command.h"
|
||||
#include "util/parse-events.h"
|
||||
#include "util/string.h"
|
||||
#include "util/debugfs.h"
|
||||
|
||||
const char perf_usage_string[] =
|
||||
"perf [--version] [--help] COMMAND [ARGS]";
|
||||
@@ -286,8 +287,10 @@ static void handle_internal_command(int argc, const char **argv)
|
||||
static struct cmd_struct commands[] = {
|
||||
{ "help", cmd_help, 0 },
|
||||
{ "list", cmd_list, 0 },
|
||||
{ "buildid-list", cmd_buildid_list, 0 },
|
||||
{ "record", cmd_record, 0 },
|
||||
{ "report", cmd_report, 0 },
|
||||
{ "bench", cmd_bench, 0 },
|
||||
{ "stat", cmd_stat, 0 },
|
||||
{ "timechart", cmd_timechart, 0 },
|
||||
{ "top", cmd_top, 0 },
|
||||
@@ -383,45 +386,12 @@ static int run_argv(int *argcp, const char ***argv)
|
||||
/* mini /proc/mounts parser: searching for "^blah /mount/point debugfs" */
|
||||
static void get_debugfs_mntpt(void)
|
||||
{
|
||||
FILE *file;
|
||||
char fs_type[100];
|
||||
char debugfs[MAXPATHLEN];
|
||||
const char *path = debugfs_find_mountpoint();
|
||||
|
||||
/*
|
||||
* try the standard location
|
||||
*/
|
||||
if (valid_debugfs_mount("/sys/kernel/debug/") == 0) {
|
||||
strcpy(debugfs_mntpt, "/sys/kernel/debug/");
|
||||
return;
|
||||
}
|
||||
|
||||
/*
|
||||
* try the sane location
|
||||
*/
|
||||
if (valid_debugfs_mount("/debug/") == 0) {
|
||||
strcpy(debugfs_mntpt, "/debug/");
|
||||
return;
|
||||
}
|
||||
|
||||
/*
|
||||
* give up and parse /proc/mounts
|
||||
*/
|
||||
file = fopen("/proc/mounts", "r");
|
||||
if (file == NULL)
|
||||
return;
|
||||
|
||||
while (fscanf(file, "%*s %"
|
||||
STR(MAXPATHLEN)
|
||||
"s %99s %*s %*d %*d\n",
|
||||
debugfs, fs_type) == 2) {
|
||||
if (strcmp(fs_type, "debugfs") == 0)
|
||||
break;
|
||||
}
|
||||
fclose(file);
|
||||
if (strcmp(fs_type, "debugfs") == 0) {
|
||||
strncpy(debugfs_mntpt, debugfs, MAXPATHLEN);
|
||||
debugfs_mntpt[MAXPATHLEN - 1] = '\0';
|
||||
}
|
||||
if (path)
|
||||
strncpy(debugfs_mntpt, path, sizeof(debugfs_mntpt));
|
||||
else
|
||||
debugfs_mntpt[0] = '\0';
|
||||
}
|
||||
|
||||
int main(int argc, const char **argv)
|
||||
|
Reference in New Issue
Block a user