コード例 #1
0
static void bm_test_pointer(unsigned char with_printing)
{
    int  counter = NUM_OF_LOOP_TEST;

    bm_test_t* node;
    bm_test_t node1, node2;

    node1.sum = 1;
    node2.sum = 1;

    node1.next = &node2;
    node2.next = &node1;

    node = &node1;
    {
        CL_TRACE_START_L0();
        while (--counter)
        {
            node->sum += node->next->sum;
            node = node->next;
        }
        CL_TRACE_END_L0();
    }
    if (with_printing!=False)
    {
        printk("bm_test_pointer result: %lu\n", node->sum); /* disable the optimizer to optimize this test */
    }
}
コード例 #2
0
static void bm_test_tlb_miss(unsigned char with_printing)
{
    int* p_buffer;
    int counter = NUM_OF_LOOP_TEST;
    int line_counter = 0;
    int num = 0;
    unsigned int i;

    /* we used eight pages to generate cache miss (8 is factor of 2 good for optimizations) */
    /* the */
    /* one extra page for aligment */
    p_buffer = BM_ALLOC(0, TLB_FAIL_MEM_REQUIRED, 32);
    for (i=0; i<TLB_FAIL_MEM_REQUIRED/sizeof(int); ++i)
        p_buffer[i] = 1;
    {
        CL_TRACE_START_L0();
        while (--counter)
        {
            num += p_buffer[line_counter];
            line_counter += (PAGE_SIZE/sizeof(int)); /* move to the next line */
            line_counter = line_counter%(TLB_FAIL_MEM_REQUIRED/sizeof(int)); /* make sure you stay in the memory chunk */
        }
        CL_TRACE_END_L0();
    }

    if (with_printing!=False)
    {
	  printk("bm_test_tlb_miss result: %d\n", num); /* disable the optimizer to optimize this test */
	}
    BM_FREE(0, p_buffer, TLB_FAIL_MEM_REQUIRED);
}
コード例 #3
0
static void bm_test_cache_miss(unsigned char with_printing)
{
	int *p_buffer;
	int counter = NUM_OF_LOOP_TEST;
	int line_counter = 0;
	int num = 0;
	int i;

	/* we used eight pages to generate cache miss (8 is factor of 2 
	* good for optimizations)  the one extra page for aligment
	*/
	p_buffer = BM_ALLOC(0, CACHE_MISS_MEM_REQUIRED, 32);
	 /* init and make sure all TLBs' are set */
	for (i = 0; i < CACHE_MISS_MEM_REQUIRED / sizeof(int); ++i)
		p_buffer[i] = 1;

	{
		CL_TRACE_START_L0();
		while (--counter) {
			num += p_buffer[line_counter];
			/* move to the next line */
			line_counter += (CACHE_LINE_SIZE / sizeof(int));
			/* make sure you stay in the memory chunk */
			line_counter = 
			line_counter % (CACHE_MISS_MEM_REQUIRED / sizeof(int));
		}
		CL_TRACE_END_L0();
	}
	if (with_printing != False) {
		/* disable the optimizer to optimize this test */
		printk("bm_test_cache_miss result: %d\n", num);
	}
	BM_FREE(0, p_buffer, CACHE_MISS_MEM_REQUIRED);
}
コード例 #4
0
static void bm_test_function_call(unsigned char with_printing)
{
    unsigned long result;

    CL_TRACE_START_L0();
    result = bm_test_fibonacci(NUM_OF_FUNCTION_CALL_TEST, 1, 1);
    CL_TRACE_END_L0();
    if (with_printing!=False)
    {
        printk("bm_test_function_call result: %lu\n", result); /* disable the optimizer to optimize this test */
    }
}
コード例 #5
0
static void bm_mis_calibration(unsigned char with_printing)
{
    int counter = NUM_OF_LOOP_TEST;
    int line_counter = 0;
    CL_TRACE_START_L0();
    while (--counter)
    {
        line_counter += (CACHE_LINE_SIZE/sizeof(int)); /* move to the next line */
        line_counter = line_counter%(CACHE_MISS_MEM_REQUIRED/sizeof(int)); /* make sure you stay in the memory chunk */
    }
    CL_TRACE_END_L0();
    if (with_printing!=False)
    {
        printk("bm_mis_calibration result: %d\n", line_counter); /* disable the optimizer to optimize this test */
    }
}
コード例 #6
0
static void bm_test_simple_loop(unsigned char with_printing, int loop_count, int nop)
{
    unsigned long num = 0x5a5; /* this will mask the optimizer to cut out the loop */
    int i;

    CL_TRACE_START_L0();
    for (i=0; i<NUM_OF_LOOP_TEST; ++i)
    {
	  ++num;
	  if (nop)
      {
		printk("%d\n",(int)num);
	  }
    }
    CL_TRACE_END_L0();
    if (with_printing!=False)
    {
        printk("bm_test_simple_loop result: %lu\n", num); /* disable the optimizer to optimize this test */
    }
}
コード例 #7
0
static void bm_test_two_seq_samples(void)
{
    CL_TRACE_START_L0();
    CL_TRACE_END_L0();
}