Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 147714
b: refs/heads/master
c: f7b7c26
h: refs/heads/master
v: v3
  • Loading branch information
Peter Zijlstra authored and Ingo Molnar committed Jun 10, 2009
1 parent 546043d commit 0f0976b
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 1 deletion.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 4502d77c1d8f15f20c04b92cb96c12d4e465de29
refs/heads/master: f7b7c26e01e51fe46097e11f179dc71ce7950084
12 changes: 12 additions & 0 deletions trunk/tools/perf/builtin-record.c
Original file line number Diff line number Diff line change
Expand Up @@ -169,10 +169,21 @@ static void mmap_read(struct mmap_data *md)
}

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

static void sig_handler(int sig)
{
done = 1;
signr = sig;
}

static void sig_atexit(void)
{
if (signr == -1)
return;

signal(signr, SIG_DFL);
kill(getpid(), signr);
}

static void pid_synthesize_comm_event(pid_t pid, int full)
Expand Down Expand Up @@ -459,6 +470,7 @@ static int __cmd_record(int argc, const char **argv)
} else for (i = 0; i < nr_cpus; i++)
open_counters(i, target_pid);

atexit(sig_atexit);
signal(SIGCHLD, sig_handler);
signal(SIGINT, sig_handler);

Expand Down
13 changes: 13 additions & 0 deletions trunk/tools/perf/builtin-stat.c
Original file line number Diff line number Diff line change
Expand Up @@ -296,8 +296,20 @@ static int do_perf_stat(int argc, const char **argv)
return 0;
}

static volatile int signr = -1;

static void skip_signal(int signo)
{
signr = signo;
}

static void sig_atexit(void)
{
if (signr == -1)
return;

signal(signr, SIG_DFL);
kill(getpid(), signr);
}

static const char * const stat_usage[] = {
Expand Down Expand Up @@ -345,6 +357,7 @@ int cmd_stat(int argc, const char **argv, const char *prefix)
* What we want is for Ctrl-C to work in the exec()-ed
* task, but being ignored by perf stat itself:
*/
atexit(sig_atexit);
signal(SIGINT, skip_signal);
signal(SIGALRM, skip_signal);
signal(SIGABRT, skip_signal);
Expand Down

0 comments on commit 0f0976b

Please sign in to comment.