Пример #1
0
int main(int argc, char **argv) {
  int i;

  ram_init();
  cpu_reset();
  load_rom("microwriter.rom");
  
  for (i = 0; i < 10000; i++) {
    cpu_cycle();
  }

  printf("Done.\n");
  ram_free();

  return 0;
}
Пример #2
0
static void run_benchmark(coreid_t core, int requests)
{
    errval_t err;
    struct capref ramcap;

    
    int i = -1;
    int bits = MEM_BITS;

    debug_printf("starting benchmark. allocating mem of size: %d\n", bits);
    //debug_printf("starting benchmark. allocating mem of size: %d to %d\n", 
    //             MINSIZEBITS, MINSIZEBITS+requests-1);


    sleep_init();

    // NOTE: because this is allocating and freeing, it should never stop.
    // it should also never have to steal

    do {
        i++;
        // bits =  MINSIZEBITS+i;
        trace_event(TRACE_SUBSYS_MEMTEST, TRACE_EVENT_MEMTEST_ALLOC, i);
        err = ram_alloc(&ramcap, bits);
        if (err_is_fail(err)) {
            DEBUG_ERR(err, "ram_alloc failed");
        }
        milli_sleep(1);
        err = ram_free(ramcap);
        if (err_is_fail(err)) {
            DEBUG_ERR(err, "ram_free failed");
        }
        if ((i % 500 == 0) && (i > 0)) {
            debug_printf("allocated %d caps\n", i);
        }
    } while (err_is_ok(err)); // && (i < requests));

    debug_printf("done benchmark. allocated %d caps (%lu bytes)\n", 
                 i, i * (1UL << bits));

}