Testing

  1. Make sure that the perfctr device is available at /dev/perfctr.
  2. Run perfex test to test a-mode counters (You will get 0 here if you forgot to enable perfctr option in GRUB.) By default, you will only see TSC. You can also specify any supported hardware event (-e option) but the event type depends on your hardware, and subsequently no example is presented here. PAPI tests (see below) do not require you to know the actual event number.
  3. root@ubuntu:~# perfex true
    tsc				            5695128
  4. After this you can test i-mode counters for which a special signal test exists. You should get something similar to this.
  5. root@ubuntu:~/perfctr-2.6.42/examples/signal# ./signal
    Control used:
    tsc_on			1
    nractrs			0
    nrictrs			2
    pmc_map[0]		0
    evntsel[0]		0x0051FF10
    ireset[0]		-25
    pmc_map[1]		1
    evntsel[1]		0x005100C4
    ireset[1]		-25
    
    on_sigio: PMC overflow set 0x2 at pc 0x7fd5d6a4aa47
    on_sigio: PMC overflow set 0x2 at pc 0x7fd5d6a4aa47
    on_sigio: PMC overflow set 0x2 at pc 0x7fd5d6a4aa47
    on_sigio: PMC overflow set 0x2 at pc 0x7fd5d6a4aa47
    on_sigio: PMC overflow set 0x2 at pc 0x7fd5d6a4aa47
    on_sigio: PMC overflow set 0x2 at pc 0x7fd5d6a4aa47
    ...
    on_sigio: PMC overflow set 0x3 at pc 0x7fd5d6a4aa47
  6. If you installed PAPI, you can run some built-in tests.
    The following test will affect a-mode counters.
  7. root@ubuntu:~/papi-4.1.0/src/ctests# ./zero
    Test case 0: start, stop.
    -----------------------------------------------
    Default domain is: 1 (PAPI_DOM_USER)
    Default granularity is: 1 (PAPI_GRN_THR)
    Using 20000000 iterations of c += a*b
    -------------------------------------------------------------------------
    Test type    : 	           1
    PAPI_FP_INS  : 	     59998672
    PAPI_TOT_CYC : 	    201096584
    Real usec    : 	        84198
    Real cycles  : 	    190371459
    Virt usec    : 	        84195
    Virt cycles  : 	    190363923
    -------------------------------------------------------------------------
    Verification: none
    zero.c                                   PASSED
  8. The following test will affect i-mode counters.
  9. root@ubuntu:~/papi-4.1.0/src/ctests# ./overflow
    ...
    handler(0 ) Overflow at 0x40282c! bit=0x2 
    handler(0 ) Overflow at 0x402813! bit=0x2 
    handler(0 ) Overflow at 0x40283f! bit=0x2 
    Test case: Overflow dispatch of 2nd event in set with 2 events.
    ---------------------------------------------------------------
    Threshold for overflow is: 1000000
    Using 20000000 iterations of c += a*b
    -----------------------------------------------
    Test type    :                1               2
    PAPI_FP_INS  :         59999127        59998329
    PAPI_TOT_CYC :        201339533       202176272
    Overflows    :                               59
    -----------------------------------------------
    Verification:
    Row 1 approximately equals 40000000 40000000
    Column 1 approximately equals column 2
    Row 3 approximately equals 59 +- 75 %
    Overflows: total(59) > max(104) || total(59) < min(14) overflow.c                               PASSED