Exemple #1
0
real_core::real_core(const config & conf)
  :
    config_(conf),

    instrumentation_(conf),

    executor_pool_(instrumentation_, conf),

    main_loop_(make_main_async_loop()),

    scheduler_(new real_scheduler()),

    externals_(new real_external(conf, instrumentation_)),

    streams_(new streams(conf, instrumentation_)),

    pubsub_(new pub_sub()),

    index_(new real_index(*pubsub_, [=](e_t e) { streams_->push_event(e); },
                          conf.index_expire_interval, *scheduler_,
                          instrumentation_, detach_thread)),

    tcp_server_(init_tcp_server(conf, *main_loop_, *streams_,
                executor_pool_, instrumentation_)),

    udp_server_(init_udp_server(conf, streams_)),

    ws_server_(init_ws_server(conf, *main_loop_, *pubsub_, *index_))
{

  if (conf.enable_internal_metrics) {
    start_instrumentation(*scheduler_, instrumentation_, *streams_);
  }

}
Exemple #2
0
int main(int argc, char const *argv[])
{
  pageloop pl;
  // init pl
  pl.port = UDP_PORT;
  pl.pages = 256;               // 256 pages * 4K = 1M of mmap area
  pl.working_pages = 1;         // only touch one page per request
  pl.offset_working_pages = 0;  // don't move working set

  if (argc > 1) {
    pl.pages = atoi(argv[1]);
  }
  if (argc > 2) {
    pl.working_pages = atoi(argv[2]);
  }
  if (argc > 3) {
    pl.offset_working_pages = atoi(argv[3]);
  } 
  if (argc > 4) {
    printf("usage: %s [total_pages] [working_pages] [offset_working_pages]", argv[0]);
    exit(EXIT_FAILURE);
  }
  pl.mem_size = pl.pages * PAGE_SIZE;
  
  init_udp_server(&pl);
  init_vma(&pl);

  while (serve_one_request(&pl));

  return EXIT_SUCCESS;
}