summaryrefslogtreecommitdiff
path: root/tools/perf/util
diff options
context:
space:
mode:
authorArnaldo Carvalho de Melo <acme@redhat.com>2015-02-24 18:34:23 (GMT)
committerArnaldo Carvalho de Melo <acme@redhat.com>2015-02-24 18:34:23 (GMT)
commit07c1a0dadfce976e9877c55ce5212dd14753c91d (patch)
tree4c2e688b84fb3bf437a4fe2898ae51494f9cf540 /tools/perf/util
parent280836812f5f821d26393268010f211160874810 (diff)
downloadlinux-07c1a0dadfce976e9877c55ce5212dd14753c91d.tar.xz
perf tools: Introduce dump_stack signal helper
To use in stdio based tools, like 'trace'. Cc: Adrian Hunter <adrian.hunter@intel.com> Cc: Borislav Petkov <bp@suse.de> Cc: David Ahern <dsahern@gmail.com> Cc: Don Zickus <dzickus@redhat.com> Cc: Frederic Weisbecker <fweisbec@gmail.com> Cc: Jiri Olsa <jolsa@redhat.com> Cc: Namhyung Kim <namhyung@kernel.org> Cc: Stephane Eranian <eranian@google.com> Link: http://lkml.kernel.org/n/tip-79kjmerlw6d88csyx1afzwvn@git.kernel.org Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools/perf/util')
-rw-r--r--tools/perf/util/util.c7
-rw-r--r--tools/perf/util/util.h1
2 files changed, 8 insertions, 0 deletions
diff --git a/tools/perf/util/util.c b/tools/perf/util/util.c
index 92db3f1..4ee6d0d 100644
--- a/tools/perf/util/util.c
+++ b/tools/perf/util/util.c
@@ -269,6 +269,13 @@ void dump_stack(void)
void dump_stack(void) {}
#endif
+void sighandler_dump_stack(int sig)
+{
+ psignal(sig, "perf");
+ dump_stack();
+ exit(sig);
+}
+
void get_term_dimensions(struct winsize *ws)
{
char *s = getenv("LINES");
diff --git a/tools/perf/util/util.h b/tools/perf/util/util.h
index 73c2f8e..fbd598a 100644
--- a/tools/perf/util/util.h
+++ b/tools/perf/util/util.h
@@ -277,6 +277,7 @@ char *ltrim(char *s);
char *rtrim(char *s);
void dump_stack(void);
+void sighandler_dump_stack(int sig);
extern unsigned int page_size;
extern int cacheline_size;