Example #1
0
int mt65xx_mon_disable(void)
{
    disable_arm11_perf_mon();

    mt65xx_reg_sync_writel(0, PL310_BASE + L2X0_EVENT_CNT_CTRL);

    BM_Pause();
    
    return 0;
}
Example #2
0
/*
 * mt65xx_mon_disable: Disable hardware monitors.
 * Return 0.
 */
int mt65xx_mon_disable(void)
{
    // disable ARM performance monitors
    armV7_perf_mon_enable(0);

    // disable all L2C event counters
    mt65xx_reg_sync_writel(0, PL310_BASE + L2X0_EVENT_CNT_CTRL);

    BM_Pause();
    
    return 0;
}
Example #3
0
/*
 * mt65xx_mon_disable: Disable hardware monitors.
 * Return 0.
 */
int mt65xx_mon_disable(void)
{
    unsigned long flags;
    // disable ARM performance monitors
    p_pmu->stop();
    
    // disable all L2C event counters
    raw_spin_lock_irqsave(&l2x0_lock, flags);
    __raw_writel(0, PL310_BASE + L2X0_EVENT_CNT_CTRL);
    dsb();
    raw_spin_unlock_irqrestore(&l2x0_lock, flags);

    BM_Pause();
    
    return 0;
}
static unsigned int emi_polling(unsigned int *emi_value)
{
	int i;
	int j = -1;

	BM_Pause();

	// Get Bus Cycle Count
	emi_value[++j] = BM_GetBusCycCount();

	/* To derive the bandwidth % usage (BSCT / BACT) */
	// Get Word Count
	for (i=0; i<EMI_NCOUNTER; i++) {
		emi_value[++j] = BM_GetWordCount(i+1);
	}

	// Get Word Count for all masters
	emi_value[++j] = BM_GetWordAllCount();

	// Get Bus Busy Count
	for (i=0; i<EMI_NCOUNTER; i++) {
		emi_value[++j] = BM_GetBusBusyCount(i+1);
	}
	// Get Bus Busy Count for all masters
	emi_value[++j] = BM_GetBusBusyAllCount();

	// Get Transaction Count
	emi_value[++j] = BM_GetEMIClockCount();

	// Get Latency and Transaction
	emi_value[++j] = LM_GetWTransCount();
	emi_value[++j] = LM_GetWLatCount();
	emi_value[++j] = LM_GetRTransCount();
	emi_value[++j] = LM_GetRLatCount();

	// Disable
	BM_Enable(0);
	LM_Enable(0);
	// Enable
	BM_Enable(1);
	LM_Enable(1);

	return j+1;
}
unsigned long long get_mem_bw(void)
{
    unsigned long long throughput;
    unsigned long long WordAllCount;
    unsigned long long current_time_ns, time_period_ns;
    int count, value;
    int emi_dcm_disable = BM_GetEmiDcm();

#if DISABLE_FLIPPER_FUNC    
return 0;
#endif

    //printk("[get_mem_bw]emi_dcm_disable = %d\n", emi_dcm_disable);
    current_time_ns = sched_clock();
    time_period_ns = current_time_ns - last_time_ns;
    //printk("[get_mem_bw]last_time=%llu, current_time=%llu, period=%llu\n", last_time_ns, current_time_ns, time_period_ns);
    
    //disable_infra_dcm();
    BM_SetEmiDcm(0xff); //disable EMI dcm
        
    BM_Pause();
    WordAllCount = BM_GetWordAllCount();
    if(WordAllCount == 0) 
        LastWordAllCount = 0;

    WordAllCount -= LastWordAllCount;
    throughput = (WordAllCount * 8 * 1000);
    do_div(throughput,time_period_ns);
    //printk("[get_mem_bw]Total MEMORY THROUGHPUT =%llu(MB/s), WordAllCount_delta = 0x%llx, LastWordAllCount = 0x%llx\n",throughput, WordAllCount, LastWordAllCount);

    // stopping EMI monitors will reset all counters
    BM_Enable(0);
    
    value = BM_GetWordAllCount();
    count = 100;
    if((value != 0) && (value > 0xB0000000))
    {  
      do
      {
        if((value = BM_GetWordAllCount()) != 0)
        {
          count--;
          BM_Enable(1);
          BM_Enable(0);
        }
        else
        {
          break;
        }
      }while(count > 0);      
    }
    LastWordAllCount = value;
    
    //printk("[get_mem_bw]loop count = %d, last_word_all_count = 0x%x\n", count, LastWordAllCount);
   
    // start EMI monitor counting
    BM_Enable(1);
    last_time_ns = sched_clock();
    
    //restore_infra_dcm();      
    BM_SetEmiDcm(emi_dcm_disable); 
    
    //printk("[get_mem_bw]throughput = %llx\n", throughput); 
    
    return throughput;
}