mirror of
https://github.com/Fishwaldo/Star64_linux.git
synced 2025-07-23 07:12:09 +00:00
perf tools: Remove some unused functions
Without the bloated cplus_demangle from binutils, i.e building with: $ make NO_DEMANGLE=1 O=~acme/git/build/perf -j3 -C tools/perf/ install Before: text data bss dec hex filename 471851 29280 4025056 4526187 45106b /home/acme/bin/perf After: [acme@doppio linux-2.6-tip]$ size ~/bin/perf text data bss dec hex filename 446886 29232 4008576 4484694 446e56 /home/acme/bin/perf So its a 5.3% size reduction in code, but the interesting part is in the git diff --stat output: 19 files changed, 20 insertions(+), 1909 deletions(-) If we ever need some of the things we got from git but weren't using, we just have to go to the git repo and get fresh, uptodate source code bits. Cc: Frédéric Weisbecker <fweisbec@gmail.com> Cc: Mike Galbraith <efault@gmx.de> Cc: Paul Mackerras <paulus@samba.org> Cc: Peter Zijlstra <a.p.zijlstra@chello.nl> Cc: Tom Zanussi <tzanussi@gmail.com> LKML-Reference: <new-submission> Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
This commit is contained in:
parent
5af52b51f7
commit
a41794cdd7
19 changed files with 20 additions and 1909 deletions
|
@ -212,93 +212,3 @@ int run_command_v_opt(const char **argv, int opt)
|
|||
prepare_run_command_v_opt(&cmd, argv, opt);
|
||||
return run_command(&cmd);
|
||||
}
|
||||
|
||||
int run_command_v_opt_cd_env(const char **argv, int opt, const char *dir, const char *const *env)
|
||||
{
|
||||
struct child_process cmd;
|
||||
prepare_run_command_v_opt(&cmd, argv, opt);
|
||||
cmd.dir = dir;
|
||||
cmd.env = env;
|
||||
return run_command(&cmd);
|
||||
}
|
||||
|
||||
int start_async(struct async *async)
|
||||
{
|
||||
int pipe_out[2];
|
||||
|
||||
if (pipe(pipe_out) < 0)
|
||||
return error("cannot create pipe: %s", strerror(errno));
|
||||
async->out = pipe_out[0];
|
||||
|
||||
/* Flush stdio before fork() to avoid cloning buffers */
|
||||
fflush(NULL);
|
||||
|
||||
async->pid = fork();
|
||||
if (async->pid < 0) {
|
||||
error("fork (async) failed: %s", strerror(errno));
|
||||
close_pair(pipe_out);
|
||||
return -1;
|
||||
}
|
||||
if (!async->pid) {
|
||||
close(pipe_out[0]);
|
||||
exit(!!async->proc(pipe_out[1], async->data));
|
||||
}
|
||||
close(pipe_out[1]);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int finish_async(struct async *async)
|
||||
{
|
||||
int ret = 0;
|
||||
|
||||
if (wait_or_whine(async->pid))
|
||||
ret = error("waitpid (async) failed");
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
int run_hook(const char *index_file, const char *name, ...)
|
||||
{
|
||||
struct child_process hook;
|
||||
const char **argv = NULL, *env[2];
|
||||
char idx[PATH_MAX];
|
||||
va_list args;
|
||||
int ret;
|
||||
size_t i = 0, alloc = 0;
|
||||
|
||||
if (access(perf_path("hooks/%s", name), X_OK) < 0)
|
||||
return 0;
|
||||
|
||||
va_start(args, name);
|
||||
ALLOC_GROW(argv, i + 1, alloc);
|
||||
argv[i++] = perf_path("hooks/%s", name);
|
||||
while (argv[i-1]) {
|
||||
ALLOC_GROW(argv, i + 1, alloc);
|
||||
argv[i++] = va_arg(args, const char *);
|
||||
}
|
||||
va_end(args);
|
||||
|
||||
memset(&hook, 0, sizeof(hook));
|
||||
hook.argv = argv;
|
||||
hook.no_stdin = 1;
|
||||
hook.stdout_to_stderr = 1;
|
||||
if (index_file) {
|
||||
snprintf(idx, sizeof(idx), "PERF_INDEX_FILE=%s", index_file);
|
||||
env[0] = idx;
|
||||
env[1] = NULL;
|
||||
hook.env = env;
|
||||
}
|
||||
|
||||
ret = start_command(&hook);
|
||||
free(argv);
|
||||
if (ret) {
|
||||
warning("Could not spawn %s", argv[0]);
|
||||
return ret;
|
||||
}
|
||||
ret = finish_command(&hook);
|
||||
if (ret == -ERR_RUN_COMMAND_WAITPID_SIGNAL)
|
||||
warning("%s exited due to uncaught signal", argv[0]);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue