Release 4.14 tools/perf/builtin-top.c
/*
* builtin-top.c
*
* Builtin top command: Display a continuously updated profile of
* any workload, CPU or specific PID.
*
* Copyright (C) 2008, Red Hat Inc, Ingo Molnar <mingo@redhat.com>
* 2011, Red Hat Inc, Arnaldo Carvalho de Melo <acme@redhat.com>
*
* Improvements and fixes by:
*
* Arjan van de Ven <arjan@linux.intel.com>
* Yanmin Zhang <yanmin.zhang@intel.com>
* Wu Fengguang <fengguang.wu@intel.com>
* Mike Galbraith <efault@gmx.de>
* Paul Mackerras <paulus@samba.org>
*
* Released under the GPL v2. (and only v2, not any later version)
*/
#include "builtin.h"
#include "perf.h"
#include "util/annotate.h"
#include "util/config.h"
#include "util/color.h"
#include "util/drv_configs.h"
#include "util/evlist.h"
#include "util/evsel.h"
#include "util/event.h"
#include "util/machine.h"
#include "util/session.h"
#include "util/symbol.h"
#include "util/thread.h"
#include "util/thread_map.h"
#include "util/top.h"
#include <linux/rbtree.h>
#include <subcmd/parse-options.h>
#include "util/parse-events.h"
#include "util/cpumap.h"
#include "util/xyarray.h"
#include "util/sort.h"
#include "util/term.h"
#include "util/intlist.h"
#include "util/parse-branch-options.h"
#include "arch/common.h"
#include "util/debug.h"
#include <assert.h>
#include <elf.h>
#include <fcntl.h>
#include <stdio.h>
#include <termios.h>
#include <unistd.h>
#include <inttypes.h>
#include <errno.h>
#include <time.h>
#include <sched.h>
#include <signal.h>
#include <sys/syscall.h>
#include <sys/ioctl.h>
#include <poll.h>
#include <sys/prctl.h>
#include <sys/wait.h>
#include <sys/uio.h>
#include <sys/utsname.h>
#include <sys/mman.h>
#include <linux/stringify.h>
#include <linux/time64.h>
#include <linux/types.h>
#include "sane_ctype.h"
static volatile int done;
#define HEADER_LINE_NR 5
static void perf_top__update_print_entries(struct perf_top *top)
{
top->print_entries = top->winsize.ws_row - HEADER_LINE_NR;
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Arnaldo Carvalho de Melo | 17 | 73.91% | 4 | 80.00% |
Namhyung Kim | 6 | 26.09% | 1 | 20.00% |
Total | 23 | 100.00% | 5 | 100.00% |
static void perf_top__sig_winch(int sig __maybe_unused,
siginfo_t *info __maybe_unused, void *arg)
{
struct perf_top *top = arg;
get_term_dimensions(&top->winsize);
perf_top__update_print_entries(top);
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Arnaldo Carvalho de Melo | 37 | 94.87% | 3 | 75.00% |
Irina Tirdea | 2 | 5.13% | 1 | 25.00% |
Total | 39 | 100.00% | 4 | 100.00% |
static int perf_top__parse_source(struct perf_top *top, struct hist_entry *he)
{
struct symbol *sym;
struct annotation *notes;
struct map *map;
int err = -1;
if (!he || !he->ms.sym)
return -1;
sym = he->ms.sym;
map = he->ms.map;
/*
* We can't annotate with just /proc/kallsyms
*/
if (map->dso->symtab_type == DSO_BINARY_TYPE__KALLSYMS &&
!dso__is_kcore(map->dso)) {
pr_err("Can't annotate %s: No vmlinux file was found in the "
"path\n", sym->name);
sleep(1);
return -1;
}
notes = symbol__annotation(sym);
if (notes->src != NULL) {
pthread_mutex_lock(¬es->lock);
goto out_assign;
}
pthread_mutex_lock(¬es->lock);
if (symbol__alloc_hist(sym) < 0) {
pthread_mutex_unlock(¬es->lock);
pr_err("Not enough memory for annotating '%s' symbol!\n",
sym->name);
sleep(1);
return err;
}
err = symbol__disassemble(sym, map, NULL, 0, NULL, NULL);
if (err == 0) {
out_assign:
top->sym_filter_entry = he;
} else {
char msg[BUFSIZ];
symbol__strerror_disassemble(sym, map, err, msg, sizeof(msg));
pr_err("Couldn't annotate %s: %s\n", sym->name, msg);
}
pthread_mutex_unlock(¬es->lock);
return err;
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Arnaldo Carvalho de Melo | 180 | 68.97% | 13 | 61.90% |
Mike Galbraith | 59 | 22.61% | 1 | 4.76% |
Adrian Hunter | 8 | 3.07% | 1 | 4.76% |
Ingo Molnar | 8 | 3.07% | 2 | 9.52% |
Jin Yao | 4 | 1.53% | 2 | 9.52% |
Jiri Olsa | 1 | 0.38% | 1 | 4.76% |
Kirill Smelkov | 1 | 0.38% | 1 | 4.76% |
Total | 261 | 100.00% | 21 | 100.00% |
static void __zero_source_counters(struct hist_entry *he)
{
struct symbol *sym = he->ms.sym;
symbol__annotate_zero_histograms(sym);
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Arnaldo Carvalho de Melo | 15 | 55.56% | 2 | 66.67% |
Mike Galbraith | 12 | 44.44% | 1 | 33.33% |
Total | 27 | 100.00% | 3 | 100.00% |
static void ui__warn_map_erange(struct map *map, struct symbol *sym, u64 ip)
{
struct utsname uts;
int err = uname(&uts);
ui__warning("Out of bounds address found:\n\n"
"Addr: %" PRIx64 "\n"
"DSO: %s %c\n"
"Map: %" PRIx64 "-%" PRIx64 "\n"
"Symbol: %" PRIx64 "-%" PRIx64 " %c %s\n"
"Arch: %s\n"
"Kernel: %s\n"
"Tools: %s\n\n"
"Not all samples will be on the annotation output.\n\n"
"Please report to linux-kernel@vger.kernel.org\n",
ip, map->dso->long_name, dso__symtab_origin(map->dso),
map->start, map->end, sym->start, sym->end,
sym->binding == STB_GLOBAL ? 'g' :
sym->binding == STB_LOCAL ? 'l' : 'w', sym->name,
err ? "[unknown]" : uts.machine,
err ? "[unknown]" : uts.release, perf_version_string);
if (use_browser <= 0)
sleep(5);
map->erange_warned = true;
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Arnaldo Carvalho de Melo | 144 | 100.00% | 1 | 100.00% |
Total | 144 | 100.00% | 1 | 100.00% |
static void perf_top__record_precise_ip(struct perf_top *top,
struct hist_entry *he,
struct perf_sample *sample,
int counter, u64 ip)
{
struct annotation *notes;
struct symbol *sym = he->ms.sym;
int err = 0;
if (sym == NULL || (use_browser == 0 &&
(top->sym_filter_entry == NULL ||
top->sym_filter_entry->ms.sym != sym)))
return;
notes = symbol__annotation(sym);
if (pthread_mutex_trylock(¬es->lock))
return;
err = hist_entry__inc_addr_samples(he, sample, counter, ip);
pthread_mutex_unlock(¬es->lock);
if (unlikely(err)) {
/*
* This function is now called with he->hists->lock held.
* Release it before going to sleep.
*/
pthread_mutex_unlock(&he->hists->lock);
if (err == -ERANGE && !he->ms.map->erange_warned)
ui__warn_map_erange(he->ms.map, sym, ip);
else if (err == -ENOMEM) {
pr_err("Not enough memory for annotating '%s' symbol!\n",
sym->name);
sleep(1);
}
pthread_mutex_lock(&he->hists->lock);
}
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Arnaldo Carvalho de Melo | 122 | 60.70% | 11 | 64.71% |
Namhyung Kim | 42 | 20.90% | 4 | 23.53% |
Mike Galbraith | 30 | 14.93% | 1 | 5.88% |
Taeung Song | 7 | 3.48% | 1 | 5.88% |
Total | 201 | 100.00% | 17 | 100.00% |
static void perf_top__show_details(struct perf_top *top)
{
struct hist_entry *he = top->sym_filter_entry;
struct annotation *notes;
struct symbol *symbol;
int more;
if (!he)
return;
symbol = he->ms.sym;
notes = symbol__annotation(symbol);
pthread_mutex_lock(¬es->lock);
if (notes->src == NULL)
goto out_unlock;
printf("Showing %s for %s\n", perf_evsel__name(top->sym_evsel), symbol->name);
printf(" Events Pcnt (>=%d%%)\n", top->sym_pcnt_filter);
more = symbol__annotate_printf(symbol, he->ms.map, top->sym_evsel,
0, top->sym_pcnt_filter, top->print_entries, 4);
if (top->evlist->enabled) {
if (top->zero)
symbol__annotate_zero_histogram(symbol, top->sym_evsel->idx);
else
symbol__annotate_decay_histogram(symbol, top->sym_evsel->idx);
}
if (more != 0)
printf("%d lines not displayed, maybe increase display entries [e]\n", more);
out_unlock:
pthread_mutex_unlock(¬es->lock);
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Arnaldo Carvalho de Melo | 123 | 65.08% | 10 | 90.91% |
Mike Galbraith | 66 | 34.92% | 1 | 9.09% |
Total | 189 | 100.00% | 11 | 100.00% |
static void perf_top__print_sym_table(struct perf_top *top)
{
char bf[160];
int printed = 0;
const int win_width = top->winsize.ws_col - 1;
struct perf_evsel *evsel = top->sym_evsel;
struct hists *hists = evsel__hists(evsel);
puts(CONSOLE_CLEAR);
perf_top__header_snprintf(top, bf, sizeof(bf));
printf("%s\n", bf);
perf_top__reset_sample_counters(top);
printf("%-*.*s\n", win_width, win_width, graph_dotted_line);
if (hists->stats.nr_lost_warned !=
hists->stats.nr_events[PERF_RECORD_LOST]) {
hists->stats.nr_lost_warned =
hists->stats.nr_events[PERF_RECORD_LOST];
color_fprintf(stdout, PERF_COLOR_RED,
"WARNING: LOST %d chunks, Check IO/CPU overload",
hists->stats.nr_lost_warned);
++printed;
}
if (top->sym_filter_entry) {
perf_top__show_details(top);
return;
}
if (top->evlist->enabled) {
if (top->zero) {
hists__delete_entries(hists);
} else {
hists__decay_entries(hists, top->hide_user_symbols,
top->hide_kernel_symbols);
}
}
hists__collapse_resort(hists, NULL);
perf_evsel__output_resort(evsel, NULL);
hists__output_recalc_col_len(hists, top->print_entries - printed);
putchar('\n');
hists__fprintf(hists, false, top->print_entries - printed, win_width,
top->min_percent, stdout, symbol_conf.use_callchain);
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Arnaldo Carvalho de Melo | 178 | 70.36% | 12 | 60.00% |
Namhyung Kim | 35 | 13.83% | 5 | 25.00% |
Mike Galbraith | 24 | 9.49% | 1 | 5.00% |
Jiri Olsa | 16 | 6.32% | 2 | 10.00% |
Total | 253 | 100.00% | 20 | 100.00% |
static void prompt_integer(int *target, const char *msg)
{
char *buf = malloc(0), *p;
size_t dummy = 0;
int tmp;
fprintf(stdout, "\n%s: ", msg);
if (getline(&buf, &dummy, stdin) < 0)
return;
p = strchr(buf, '\n');
if (p)
*p = 0;
p = buf;
while(*p) {
if (!isdigit(*p))
goto out_free;
p++;
}
tmp = strtoul(buf, NULL, 10);
*target = tmp;
out_free:
free(buf);
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Mike Galbraith | 114 | 89.76% | 1 | 33.33% |
Arnaldo Carvalho de Melo | 12 | 9.45% | 1 | 33.33% |
Ingo Molnar | 1 | 0.79% | 1 | 33.33% |
Total | 127 | 100.00% | 3 | 100.00% |
static void prompt_percent(int *target, const char *msg)
{
int tmp = 0;
prompt_integer(&tmp, msg);
if (tmp >= 0 && tmp <= 100)
*target = tmp;
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Mike Galbraith | 31 | 72.09% | 1 | 50.00% |
Arnaldo Carvalho de Melo | 12 | 27.91% | 1 | 50.00% |
Total | 43 | 100.00% | 2 | 100.00% |
static void perf_top__prompt_symbol(struct perf_top *top, const char *msg)
{
char *buf = malloc(0), *p;
struct hist_entry *syme = top->sym_filter_entry, *n, *found = NULL;
struct hists *hists = evsel__hists(top->sym_evsel);
struct rb_node *next;
size_t dummy = 0;
/* zero counters of active symbol */
if (syme) {
__zero_source_counters(syme);
top->sym_filter_entry = NULL;
}
fprintf(stdout, "\n%s: ", msg);
if (getline(&buf, &dummy, stdin) < 0)
goto out_free;
p = strchr(buf, '\n');
if (p)
*p = 0;
next = rb_first(&hists->entries);
while (next) {
n = rb_entry(next, struct hist_entry, rb_node);
if (n->ms.sym && !strcmp(buf, n->ms.sym->name)) {
found = n;
break;
}
next = rb_next(&n->rb_node);
}
if (!found) {
fprintf(stderr, "Sorry, %s is not active.\n", buf);
sleep(1);
} else
perf_top__parse_source(top, found);
out_free:
free(buf);
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Arnaldo Carvalho de Melo | 119 | 51.07% | 5 | 62.50% |
Mike Galbraith | 110 | 47.21% | 1 | 12.50% |
Ingo Molnar | 3 | 1.29% | 1 | 12.50% |
Kirill Smelkov | 1 | 0.43% | 1 | 12.50% |
Total | 233 | 100.00% | 8 | 100.00% |
static void perf_top__print_mapped_keys(struct perf_top *top)
{
char *name = NULL;
if (top->sym_filter_entry) {
struct symbol *sym = top->sym_filter_entry->ms.sym;
name = sym->name;
}
fprintf(stdout, "\nMapped keys:\n");
fprintf(stdout, "\t[d] display refresh delay. \t(%d)\n", top->delay_secs);
fprintf(stdout, "\t[e] display entries (lines). \t(%d)\n", top->print_entries);
if (top->evlist->nr_entries > 1)
fprintf(stdout, "\t[E] active event counter. \t(%s)\n", perf_evsel__name(top->sym_evsel));
fprintf(stdout, "\t[f] profile display filter (count). \t(%d)\n", top->count_filter);
fprintf(stdout, "\t[F] annotate display filter (percent). \t(%d%%)\n", top->sym_pcnt_filter);
fprintf(stdout, "\t[s] annotate symbol. \t(%s)\n", name?: "NULL");
fprintf(stdout, "\t[S] stop annotation.\n");
fprintf(stdout,
"\t[K] hide kernel_symbols symbols. \t(%s)\n",
top->hide_kernel_symbols ? "yes" : "no");
fprintf(stdout,
"\t[U] hide user symbols. \t(%s)\n",
top->hide_user_symbols ? "yes" : "no");
fprintf(stdout, "\t[z] toggle sample zeroing. \t(%d)\n", top->zero ? 1 : 0);
fprintf(stdout, "\t[qQ] quit.\n");
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Mike Galbraith | 105 | 55.26% | 3 | 18.75% |
Arnaldo Carvalho de Melo | 68 | 35.79% | 10 | 62.50% |
Ingo Molnar | 16 | 8.42% | 2 | 12.50% |
Kirill Smelkov | 1 | 0.53% | 1 | 6.25% |
Total | 190 | 100.00% | 16 | 100.00% |
static int perf_top__key_mapped(struct perf_top *top, int c)
{
switch (c) {
case 'd':
case 'e':
case 'f':
case 'z':
case 'q':
case 'Q':
case 'K':
case 'U':
case 'F':
case 's':
case 'S':
return 1;
case 'E':
return top->evlist->nr_entries > 1 ? 1 : 0;
default:
break;
}
return 0;
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Mike Galbraith | 41 | 53.25% | 2 | 28.57% |
Arnaldo Carvalho de Melo | 25 | 32.47% | 3 | 42.86% |
Kirill Smelkov | 9 | 11.69% | 1 | 14.29% |
Ingo Molnar | 2 | 2.60% | 1 | 14.29% |
Total | 77 | 100.00% | 7 | 100.00% |
static bool perf_top__handle_keypress(struct perf_top *top, int c)
{
bool ret = true;
if (!perf_top__key_mapped(top, c)) {
struct pollfd stdin_poll = { .fd = 0, .events = POLLIN };
struct termios save;
perf_top__print_mapped_keys(top);
fprintf(stdout, "\nEnter selection, or unmapped key to continue: ");
fflush(stdout);
set_term_quiet_input(&save);
poll(&stdin_poll, 1, -1);
c = getc(stdin);
tcsetattr(0, TCSAFLUSH, &save);
if (!perf_top__key_mapped(top, c))
return ret;
}
switch (c) {
case 'd':
prompt_integer(&top->delay_secs, "Enter display delay");
if (top->delay_secs < 1)
top->delay_secs = 1;
break;
case 'e':
prompt_integer(&top->print_entries, "Enter display entries (lines)");
if (top->print_entries == 0) {
struct sigaction act = {
.sa_sigaction = perf_top__sig_winch,
.sa_flags = SA_SIGINFO,
};
perf_top__sig_winch(SIGWINCH, NULL, top);
sigaction(SIGWINCH, &act, NULL);
} else {
signal(SIGWINCH, SIG_DFL);
}
break;
case 'E':
if (top->evlist->nr_entries > 1) {
/* Select 0 as the default event: */
int counter = 0;
fprintf(stderr, "\nAvailable events:");
evlist__for_each_entry(top->evlist, top->sym_evsel)
fprintf(stderr, "\n\t%d %s", top->sym_evsel->idx, perf_evsel__name(top->sym_evsel));
prompt_integer(&counter, "Enter details event counter");
if (counter >= top->evlist->nr_entries) {
top->sym_evsel = perf_evlist__first(top->evlist);
fprintf(stderr, "Sorry, no such event, using %s.\n", perf_evsel__name(top->sym_evsel));
sleep(1);
break;
}
evlist__for_each_entry(top->evlist, top->sym_evsel)
if (top->sym_evsel->idx == counter)
break;
} else
top->sym_evsel = perf_evlist__first(top->evlist);
break;
case 'f':
prompt_integer(&top->count_filter, "Enter display event count filter");
break;
case 'F':
prompt_percent(&top->sym_pcnt_filter,
"Enter details display event filter (percent)");
break;
case 'K':
top->hide_kernel_symbols = !top->hide_kernel_symbols;
break;
case 'q':
case 'Q':
printf("exiting.\n");
if (top->dump_symtab)
perf_session__fprintf_dsos(top->session, stderr);
ret = false;
break;
case 's':
perf_top__prompt_symbol(top, "Enter details symbol");
break;
case 'S':
if (!top->sym_filter_entry)
break;
else {
struct hist_entry *syme = top->sym_filter_entry;
top->sym_filter_entry = NULL;
__zero_source_counters(syme);
}
break;
case 'U':
top->hide_user_symbols = !top->hide_user_symbols;
break;
case 'z':
top->zero = !top->zero;
break;
default:
break;
}
return ret;
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Arnaldo Carvalho de Melo | 241 | 48.01% | 18 | 64.29% |
Mike Galbraith | 193 | 38.45% | 2 | 7.14% |
Ingo Molnar | 50 | 9.96% | 3 | 10.71% |
Tim Blechmann | 10 | 1.99% | 1 | 3.57% |
Akihiro Nagai | 3 | 0.60% | 1 | 3.57% |
Yanmin Zhang | 2 | 0.40% | 1 | 3.57% |
Stéphane Eranian | 2 | 0.40% | 1 | 3.57% |
Jiri Olsa | 1 | 0.20% | 1 | 3.57% |
Total | 502 | 100.00% | 28 | 100.00% |
static void perf_top__sort_new_samples(void *arg)
{
struct perf_top *t = arg;
struct perf_evsel *evsel = t->sym_evsel;
struct hists *hists;
perf_top__reset_sample_counters(t);
if (t->evlist->selected != NULL)
t->sym_evsel = t->evlist->selected;
hists = evsel__hists(evsel);
if (t->evlist->enabled) {
if (t->zero) {
hists__delete_entries(hists);
} else {
hists__decay_entries(hists, t->hide_user_symbols,
t->hide_kernel_symbols);
}
}
hists__collapse_resort(hists, NULL);
perf_evsel__output_resort(evsel, NULL);
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Arnaldo Carvalho de Melo | 72 | 62.07% | 4 | 44.44% |
Namhyung Kim | 28 | 24.14% | 2 | 22.22% |
Jiri Olsa | 12 | 10.34% | 1 | 11.11% |
Ingo Molnar | 3 | 2.59% | 1 | 11.11% |
Frédéric Weisbecker | 1 | 0.86% | 1 | 11.11% |
Total | 116 | 100.00% | 9 | 100.00% |
static void *display_thread_tui(void *arg)
{
struct perf_evsel *pos;
struct perf_top *top = arg;
const char *help = "For a higher level overview, try: perf top --sort comm,dso";
struct hist_browser_timer hbt = {
.timer = perf_top__sort_new_samples,
.arg = top,
.refresh = top->delay_secs,
};
/* In order to read symbols from other namespaces perf to needs to call
* setns(2). This isn't permitted if the struct_fs has multiple users.
* unshare(2) the fs so that we may continue to setns into namespaces
* that we're observing.
*/
unshare(CLONE_FS);
perf_top__sort_new_samples(top);
/*
* Initialize the uid_filter_str, in the future the TUI will allow
* Zooming in/out UIDs. For now juse use whatever the user passed
* via --uid.
*/
evlist__for_each_entry(top->evlist, pos) {
struct hists *hists = evsel__hists(pos);
hists->uid_filter_str = top->record_opts.target.uid_str;
}
perf_evlist__tui_browse_hists(top->evlist, help, &hbt,
top->min_percent,
&top->session->header.env);
done = 1;
return NULL;
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Arnaldo Carvalho de Melo | 81 | 63.78% | 10 | 62.50% |
Namhyung Kim | 40 | 31.50% | 5 | 31.25% |
Krister Johansen | 6 | 4.72% | 1 | 6.25% |
Total | 127 | 100.00% | 16 | 100.00% |
static void display_sig(int sig __maybe_unused)
{
done = 1;
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Jiri Olsa | 14 | 100.00% | 1 | 100.00% |
Total | 14 | 100.00% | 1 | 100.00% |
static void display_setup_sig(void)
{
signal(SIGSEGV, sighandler_dump_stack);
signal(SIGFPE, sighandler_dump_stack);
signal(SIGINT, display_sig);
signal(SIGQUIT, display_sig);
signal(SIGTERM, display_sig);
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Jiri Olsa | 41 | 95.35% | 1 | 50.00% |
Arnaldo Carvalho de Melo | 2 | 4.65% | 1 | 50.00% |
Total | 43 | 100.00% | 2 | 100.00% |
static void *display_thread(void *arg)
{
struct pollfd stdin_poll = { .fd = 0, .events = POLLIN };
struct termios save;
struct perf_top *top = arg;
int delay_msecs, c;
/* In order to read symbols from other namespaces perf to needs to call
* setns(2). This isn't permitted if the struct_fs has multiple users.
* unshare(2) the fs so that we may continue to setns into namespaces
* that we're observing.
*/
unshare(CLONE_FS);
display_setup_sig();
pthread__unblock_sigwinch();
repeat:
delay_msecs = top->delay_secs * MSEC_PER_SEC;
set_term_quiet_input(&save);
/* trash return*/
getc(stdin);
while (!done) {
perf_top__print_sym_table(top);
/*
* Either timeout expired or we got an EINTR due to SIGWINCH,
* refresh screen in both cases.
*/
switch (poll(&stdin_poll, 1, delay_msecs)) {
case 0:
continue;
case -1:
if (errno<