Blame src/perfctr-2.7.x/examples/self/ppc64.c
|
Packit |
577717 |
/* Maynard Johnson
|
|
Packit |
577717 |
* PPC64-specific code.
|
|
Packit |
577717 |
*
|
|
Packit |
577717 |
*/
|
|
Packit |
577717 |
#include <stdio.h>
|
|
Packit |
577717 |
#include <stdlib.h>
|
|
Packit |
577717 |
#include <string.h>
|
|
Packit |
577717 |
#include "libperfctr.h"
|
|
Packit |
577717 |
#include "arch.h"
|
|
Packit |
577717 |
|
|
Packit |
577717 |
void do_setup(const struct perfctr_info *info,
|
|
Packit |
577717 |
struct perfctr_cpu_control *cpu_control)
|
|
Packit |
577717 |
{
|
|
Packit |
577717 |
memset(cpu_control, 0, sizeof *cpu_control);
|
|
Packit |
577717 |
cpu_control->tsc_on = 1;
|
|
Packit |
577717 |
cpu_control->nractrs = 1;
|
|
Packit |
577717 |
cpu_control->pmc_map[0] = 0;
|
|
Packit |
577717 |
/* Set up counter 1 to count PM_INST_CMPL. Other counters are set up
|
|
Packit |
577717 |
* to count some event, but are not used in this test.
|
|
Packit |
577717 |
*/
|
|
Packit |
577717 |
if ((info->cpu_type == PERFCTR_PPC64_POWER4) ||
|
|
Packit |
577717 |
(info->cpu_type == PERFCTR_PPC64_POWER4p)) {
|
|
Packit |
577717 |
cpu_control->ppc64.mmcr0 = 0x4000090EULL;
|
|
Packit |
577717 |
cpu_control->ppc64.mmcr1 = 0x1003400045F29420ULL;
|
|
Packit |
577717 |
cpu_control->ppc64.mmcra = 0x00002000ULL;
|
|
Packit |
577717 |
} else if (info->cpu_type == PERFCTR_PPC64_POWER5) {
|
|
Packit |
577717 |
cpu_control->ppc64.mmcr0 = 0x00000000ULL;
|
|
Packit |
577717 |
cpu_control->ppc64.mmcr1 = 0x8103000602CACE8EULL;
|
|
Packit |
577717 |
cpu_control->ppc64.mmcra = 0x00000001ULL;
|
|
Packit |
577717 |
} else if (info->cpu_type == PERFCTR_PPC64_970 ||
|
|
Packit |
577717 |
info->cpu_type == PERFCTR_PPC64_970MP) {
|
|
Packit |
577717 |
cpu_control->ppc64.mmcr0 = 0x0000091EULL;
|
|
Packit |
577717 |
cpu_control->ppc64.mmcr1 = 0x4003001005F09000ULL;
|
|
Packit |
577717 |
cpu_control->ppc64.mmcra = 0x00002000ULL;
|
|
Packit |
577717 |
}
|
|
Packit |
577717 |
}
|