Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 269021
b: refs/heads/master
c: 33e49ea
h: refs/heads/master
i:
  269019: 18ca119
v: v3
  • Loading branch information
Andi Kleen authored and Arnaldo Carvalho de Melo committed Sep 29, 2011
1 parent b93c634 commit a9acbd5
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 3 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 61a9f324292e6dd4f4b99f5366454788104a0bd9
refs/heads/master: 33e49ea70df066651a17061c62118fc3f075d21f
19 changes: 17 additions & 2 deletions trunk/tools/perf/builtin-record.c
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ static off_t post_processing_offset;

static struct perf_session *session;
static const char *cpu_list;
static const char *progname;

static void advance_output(size_t size)
{
Expand Down Expand Up @@ -137,17 +138,29 @@ static void mmap_read(struct perf_mmap *md)

static volatile int done = 0;
static volatile int signr = -1;
static volatile int child_finished = 0;

static void sig_handler(int sig)
{
if (sig == SIGCHLD)
child_finished = 1;

done = 1;
signr = sig;
}

static void sig_atexit(void)
{
if (child_pid > 0)
kill(child_pid, SIGTERM);
int status;

if (child_pid > 0) {
if (!child_finished)
kill(child_pid, SIGTERM);

wait(&status);
if (WIFSIGNALED(status))
psignal(WTERMSIG(status), progname);
}

if (signr == -1 || signr == SIGUSR1)
return;
Expand Down Expand Up @@ -445,6 +458,8 @@ static int __cmd_record(int argc, const char **argv)
char buf;
struct machine *machine;

progname = argv[0];

page_size = sysconf(_SC_PAGE_SIZE);

atexit(sig_atexit);
Expand Down
2 changes: 2 additions & 0 deletions trunk/tools/perf/builtin-stat.c
Original file line number Diff line number Diff line change
Expand Up @@ -495,6 +495,8 @@ static int run_perf_stat(int argc __used, const char **argv)
if (forks) {
close(go_pipe[1]);
wait(&status);
if (WIFSIGNALED(status))
psignal(WTERMSIG(status), argv[0]);
} else {
while(!done) sleep(1);
}
Expand Down

0 comments on commit a9acbd5

Please sign in to comment.