if (fd[nr_cpu][counter] < 0) {
int err = errno;
- printf("kerneltop error: syscall returned with %d (%s)\n",
+
+ error("syscall returned with %d (%s)\n",
fd[nr_cpu][counter], strerror(err));
if (err == EPERM)
printf("Are you root?\n");
mmap_array[nr_cpu][counter].base = mmap(NULL, (mmap_pages+1)*page_size,
PROT_READ, MAP_SHARED, fd[nr_cpu][counter], 0);
if (mmap_array[nr_cpu][counter].base == MAP_FAILED) {
- printf("kerneltop error: failed to mmap with %d (%s)\n",
- errno, strerror(errno));
+ error("failed to mmap with %d (%s)\n", errno, strerror(errno));
exit(-1);
}
}
printf(
"------------------------------------------------------------------------------\n");
- printf( " KernelTop:%8.0f irqs/sec kernel:%4.1f%% [",
+ printf( " PerfTop:%8.0f irqs/sec kernel:%4.1f%% [",
events_per_sec,
100.0 - (100.0*((events_per_sec-kevents_per_sec)/events_per_sec)));
static void *display_thread(void *arg)
{
- printf("KernelTop refresh period: %d seconds\n", delay_secs);
+ printf("PerfTop refresh period: %d seconds\n", delay_secs);
while (!sleep(delay_secs))
print_sym_table();
fd[i][counter] = sys_perf_counter_open(&attr, target_pid, cpu, group_fd, 0);
if (fd[i][counter] < 0) {
int err = errno;
- printf("kerneltop error: syscall returned with %d (%s)\n",
+
+ error("syscall returned with %d (%s)\n",
fd[i][counter], strerror(err));
if (err == EPERM)
printf("Are you root?\n");
mmap_array[i][counter].mask = mmap_pages*page_size - 1;
mmap_array[i][counter].base = mmap(NULL, (mmap_pages+1)*page_size,
PROT_READ, MAP_SHARED, fd[i][counter], 0);
- if (mmap_array[i][counter].base == MAP_FAILED) {
- printf("kerneltop error: failed to mmap with %d (%s)\n",
- errno, strerror(errno));
- exit(-1);
- }
+ if (mmap_array[i][counter].base == MAP_FAILED)
+ die("failed to mmap with %d (%s)\n", errno, strerror(errno));
}
}