Example #1
0
int tcm_heap_testRun(void)
{
	alloc_test(ALLOC_SIZE, TEST_LEN);
	alloc_test(ALLOC_SIZE2, TEST_LEN2);
	/* Try to allocate the whole heap */
	uint8_t *b = tcm_heap_allocmem(HEAP_SIZE);
	int j;
	//ASSERT(b);
	//ASSERT(heap_freeSpace(&h) == 0);

	//ASSERT(!heap_allocmem(&h, HEAP_SIZE));

	for (j = 0; j < HEAP_SIZE; j++)
		b[j] = j;
	
	for (j = 0; j < HEAP_SIZE; j++)
	{
		printf("b[%d] = %d\n", j, j);
		//ASSERT(b[j] == (j & 0xff));
	}
	tcm_heap_freemem(b, HEAP_SIZE);
	//ASSERT(heap_freeSpace(&h) == HEAP_SIZE);

	return 0;
}
Example #2
0
int main(int argc, char *argv[])
{
  if (argc != 3) {
usage:
    fprintf(stderr, "Usage: %s <test_num> <alloc_size_MB>\n"
        "\ttest_num: 0 = one-sided; 1 = buffer mismatch; 2 = alloc; 3 = read/write bandwidth daemon\n"
        "\talloc_size: can be specified in any positive decimal format\n", argv[0]);

    return -1;
  }

  double reg_size_MB = strtod(argv[2], 0);
  uint64_t reg_size_B = (uint64_t)(reg_size_MB*pow(2,20));

  if(reg_size_MB > 4000.0)
  {
    printf("Please pass a data size of less than 4000 MB\n");
    return -1;
  }

  switch (atoi(argv[1])) {
    case 0:
      if (one_sided_test()) {
        fprintf(stderr, "FAIL: one_sided_test\n");
        return -1;
      } else
        printf("pass: one_sided_test\n");
      break;
    case 1:
      if (buffer_size_mismatch_test()) {
        fprintf(stderr, "FAIL: buffer_size_mismatch_test\n");
        return -1;
      } else
        printf("pass: buffer_size_mismatch_test\n");
      break;
    case 2:
      printf("Running allocation test with buffer size %4f MB and %lu B\n",reg_size_MB, reg_size_B); 
      if(alloc_test(reg_size_B)) {
        fprintf(stderr, "FAIL: alloc_test\n");
        return -1;
      } else
        printf("pass: alloc_test\n");
      break;
    case 3:
      printf("Running daemon for read/write bandwidth test\n");
      if(read_write_bw_test(reg_size_B)){
          fprintf(stderr, "FAIL: read/write bandwidth test\n");
          return -1;
      } else
          printf("PASS: read/write bandwidth test\n");
      break;

    default:
      goto usage;
  }
  return 0;
}
Example #3
0
void measure_alloc_test()
{
		uint_64_t beg, end;
		
		for(size_t i = 0; i < 500; ++i)
		{
				beg = AR_GetTime_Microseconds();
				alloc_test();
				end = AR_GetTime_Microseconds();

				printf("%d : time == %I64d\r\n", i, end - beg);
		}
}
Example #4
0
int main()
{	 
  fixed_mem_test();	 

  mem_range_test();
  
  mem_range_with_delete();

  alloc_test();

  memalign_alloc_test();

#ifndef WIN32
  stack_test();
#endif	  

  CTEST_EXIT();

  return 0;
}
Example #5
0
void get_stats() {
    // alloc_test(32);
    alloc_test(512);
    alloc_test(1024);
    alloc_test(16*1024);
}