0001
0002
0003
0004
0005
0006 #include <stdio.h>
0007 #include <stdlib.h>
0008 #include <setjmp.h>
0009 #include <signal.h>
0010
0011 #include "ebb.h"
0012
0013
0014
0015
0016
0017
0018
0019
0020 static int regs_access_pmccext(void)
0021 {
0022 struct event event;
0023
0024 SKIP_IF(!ebb_is_supported());
0025
0026 event_init_named(&event, 0x1001e, "cycles");
0027 event_leader_ebb_init(&event);
0028
0029 FAIL_IF(event_open(&event));
0030
0031 ebb_enable_pmc_counting(1);
0032 setup_ebb_handler(standard_ebb_callee);
0033 ebb_global_enable();
0034 FAIL_IF(ebb_event_enable(&event));
0035
0036 mtspr(SPRN_PMC1, pmc_sample_period(sample_period));
0037
0038 while (ebb_state.stats.ebb_count < 1)
0039 FAIL_IF(core_busy_loop());
0040
0041 ebb_global_disable();
0042 event_close(&event);
0043
0044 FAIL_IF(ebb_state.stats.ebb_count == 0);
0045
0046
0047
0048
0049
0050
0051
0052 if (have_hwcap2(PPC_FEATURE2_ARCH_3_1))
0053 FAIL_IF(catch_sigill(dump_ebb_state));
0054 else
0055 dump_ebb_state();
0056
0057 return 0;
0058 }
0059
0060 int main(void)
0061 {
0062 return test_harness(regs_access_pmccext, "regs_access_pmccext");
0063 }