builtin-top.c (fad837c16cdd856c68ce2e1335ad0fe836ed8ecd) builtin-top.c (a12b51c478899fe0b7e874a559b05ba35f1128ee)
1/*
2 * builtin-top.c
3 *
4 * Builtin top command: Display a continuously updated profile of
5 * any workload, CPU or specific PID.
6 *
7 * Copyright (C) 2008, Red Hat Inc, Ingo Molnar <mingo@redhat.com>
8 *

--- 14 unchanged lines hidden (view full) ---

23#include "util/color.h"
24#include "util/session.h"
25#include "util/symbol.h"
26#include "util/thread.h"
27#include "util/util.h"
28#include <linux/rbtree.h>
29#include "util/parse-options.h"
30#include "util/parse-events.h"
1/*
2 * builtin-top.c
3 *
4 * Builtin top command: Display a continuously updated profile of
5 * any workload, CPU or specific PID.
6 *
7 * Copyright (C) 2008, Red Hat Inc, Ingo Molnar <mingo@redhat.com>
8 *

--- 14 unchanged lines hidden (view full) ---

23#include "util/color.h"
24#include "util/session.h"
25#include "util/symbol.h"
26#include "util/thread.h"
27#include "util/util.h"
28#include <linux/rbtree.h>
29#include "util/parse-options.h"
30#include "util/parse-events.h"
31#include "util/cpumap.h"
31
32#include "util/debug.h"
33
34#include <assert.h>
35#include <fcntl.h>
36
37#include <stdio.h>
38#include <termios.h>

--- 1079 unchanged lines hidden (view full) ---

1118
1119static void start_counter(int i, int counter)
1120{
1121 struct perf_event_attr *attr;
1122 int cpu;
1123
1124 cpu = profile_cpu;
1125 if (target_pid == -1 && profile_cpu == -1)
32
33#include "util/debug.h"
34
35#include <assert.h>
36#include <fcntl.h>
37
38#include <stdio.h>
39#include <termios.h>

--- 1079 unchanged lines hidden (view full) ---

1119
1120static void start_counter(int i, int counter)
1121{
1122 struct perf_event_attr *attr;
1123 int cpu;
1124
1125 cpu = profile_cpu;
1126 if (target_pid == -1 && profile_cpu == -1)
1126 cpu = i;
1127 cpu = cpumap[i];
1127
1128 attr = attrs + counter;
1129
1130 attr->sample_type = PERF_SAMPLE_IP | PERF_SAMPLE_TID;
1131
1132 if (freq) {
1133 attr->sample_type |= PERF_SAMPLE_PERIOD;
1134 attr->freq = 1;

--- 207 unchanged lines hidden (view full) ---

1342 */
1343 for (counter = 0; counter < nr_counters; counter++) {
1344 if (attrs[counter].sample_period)
1345 continue;
1346
1347 attrs[counter].sample_period = default_interval;
1348 }
1349
1128
1129 attr = attrs + counter;
1130
1131 attr->sample_type = PERF_SAMPLE_IP | PERF_SAMPLE_TID;
1132
1133 if (freq) {
1134 attr->sample_type |= PERF_SAMPLE_PERIOD;
1135 attr->freq = 1;

--- 207 unchanged lines hidden (view full) ---

1343 */
1344 for (counter = 0; counter < nr_counters; counter++) {
1345 if (attrs[counter].sample_period)
1346 continue;
1347
1348 attrs[counter].sample_period = default_interval;
1349 }
1350
1350 nr_cpus = sysconf(_SC_NPROCESSORS_ONLN);
1351 assert(nr_cpus <= MAX_NR_CPUS);
1352 assert(nr_cpus >= 0);
1353
1354 if (target_pid != -1 || profile_cpu != -1)
1355 nr_cpus = 1;
1351 if (target_pid != -1 || profile_cpu != -1)
1352 nr_cpus = 1;
1353 else
1354 nr_cpus = read_cpu_map();
1356
1357 get_term_dimensions(&winsize);
1358 if (print_entries == 0) {
1359 update_print_entries(&winsize);
1360 signal(SIGWINCH, sig_winch_handler);
1361 }
1362
1363 return __cmd_top();
1364}
1355
1356 get_term_dimensions(&winsize);
1357 if (print_entries == 0) {
1358 update_print_entries(&winsize);
1359 signal(SIGWINCH, sig_winch_handler);
1360 }
1361
1362 return __cmd_top();
1363}