Esempio n. 1
0
File: pool.c Progetto: vinc6nt/p2pnt
int pool_test(void)
{
    enum { LOOP = 2 };
    int loop;
    int rc;

    rc = capacity_test();
    if (rc) return rc;

    for (loop=0; loop<LOOP; ++loop) {
	/* Test that the pool should grow automaticly. */
	rc = drain_test(SIZE, SIZE);
	if (rc != 0) return rc;

	/* Test situation where pool is not allowed to grow. 
 	 * We expect the test to return correct error.
	 */
	rc = drain_test(SIZE, 0);
	if (rc != -40) return rc;
    }

    rc = pool_buf_test();
    if (rc != 0)
	return rc;


    return 0;
}
Esempio n. 2
0
int main(int argc, const char **argv)
{
  slipstore::io *streams;
  rtc_clock prefill_clock;
  rtc_clock drain_clock;
  /* Get options */
  setup_options(argc, argv);
  slipchunk = vm["slipchunk"].as<unsigned long>();
  BOOST_LOG_TRIVIAL(info) << "SLIPBENCH::SLIPCHUNK "
			  << slipchunk;
  unsigned long slipfile_size = vm["slipbench_fsize"].as<unsigned long>();
  unsigned long blockmem = vm["blocked_memory"].as<unsigned long>();
  unsigned long prefill  = vm["test_prefill"].as<unsigned long>();
  /* Read in slipstore information */
  init_slipstore_desc();
  unsigned long fanout = vm["ext_fanout"].as<unsigned long>();
  BOOST_LOG_TRIVIAL(info) << "SLIPBENCH::FANOUT_UNDER_TEST "
			  << fanout;
  streams = new slipstore::io(1, 1, fanout, NULL);
  slipstore::init(streams, 100, 1); // tilesize does not matter
  unsigned char *buffer = new unsigned char[slipchunk];
  choice   = new slipstore::cyclic(fanout,
				   slipstore::slipstore_client_drain->get_me());
  if(blockmem > 0) {
    BOOST_LOG_TRIVIAL(info) << "Blocking " << blockmem;
    (void)map_anon_memory(blockmem, true, "Blockmem");
    BOOST_LOG_TRIVIAL(info) << "Done";
  }
  unsigned long drain_bytes = slipfile_size;
  if(drain_bytes < 2*fanout*slipchunk) {
    drain_bytes = 2*fanout*slipchunk;
  }
  BOOST_LOG_TRIVIAL(info) << "SLIPBENCH::PREFILL "
			  << prefill;
  BOOST_LOG_TRIVIAL(info) << "SLIPBENCH::DRAIN_AMOUNT "
			  << drain_bytes;
  /////////// Prefill
  control_barrier(); // everyone started
  prefill_clock.start();
  drain_test(buffer, prefill);
  prefill_clock.stop();
  control_barrier(); // everyone done
  prefill_clock.print("SLIPBENCH::PREFILL_TIME ");
  ////////// Drain test
  control_barrier(); // everyone started
  drain_clock.start();
  drain_test(buffer, drain_bytes);
  control_barrier(); // everyone done
  // Flush the remaining blocks
  for(unsigned long i=0;i<fanout;i++) {
    streams->rewind(slipstore::STREAM_VERTEX_STATE, 0, i);
  }
  drain_clock.stop();
  drain_clock.print("SLIPBENCH::DRAIN_TIME ");
  ///////////////////////
  slipstore::shutdown();
  delete buffer;
  delete streams;
  
}