mirror of
				https://github.com/openhwgroup/cvw
				synced 2025-02-11 06:05:49 +00:00 
			
		
		
		
	
		
			
				
	
	
		
			25 lines
		
	
	
		
			588 B
		
	
	
	
		
			C
		
	
	
	
	
	
			
		
		
	
	
			25 lines
		
	
	
		
			588 B
		
	
	
	
		
			C
		
	
	
	
	
	
| #include <stdlib.h>
 | |
| 
 | |
| #include "pcnt_driver.h"
 | |
| 
 | |
| int pre_main(int argc, char *argv[]) {
 | |
|   long int bpmp0, brcnt0, bpmp1, brcnt1;
 | |
|   long int bpmp_diff, brcnt_diff;
 | |
|   bpmp0 = readPerfCnt(BP_WRONG_DIR_COUNT, 0);
 | |
|   brcnt0 = readPerfCnt(BR_DIR_COUNT, 0);
 | |
| 
 | |
|   // enable counters
 | |
|   enablePerfCnt(BP_WRONG_DIR_COUNT_EN | BR_DIR_COUNT_EN);
 | |
| 
 | |
|   int res =  main(argc, argv);
 | |
| 
 | |
|   disablePerfCnt(BP_WRONG_DIR_COUNT_EN | BR_DIR_COUNT_EN);
 | |
| 
 | |
|   bpmp1 = readPerfCnt(BP_WRONG_DIR_COUNT, 0);
 | |
|   brcnt1 = readPerfCnt(BR_DIR_COUNT, 0);
 | |
|   bpmp_diff = bpmp1 - bpmp0;
 | |
|   brcnt_diff = brcnt1 - brcnt0;
 | |
|   
 | |
|   return res;
 | |
| }
 |