Example #1
0
static void handle_cache_load_done(void)
{
	if (!are_all_pages_loaded()) {
		return;
	}
    DEBUGPRINT("initial_cache_load: entire cache loaded done\n");
    cache_loading_phase = false;

    /* FIXME: stop the trace. */
#if ENABLE_WEB_TRACING
    trace_event(TRACE_SUBSYS_NET, TRACE_EVENT_NET_STOP, 0);

    char *buf = malloc(4096*4096);
    trace_dump(buf, 4096*4096, NULL);
    printf("%s\n", buf);

#endif // ENABLE_WEB_TRACING


    // lwip_benchmark_control(1, BMS_STOP_REQUEST, 0, 0);
    // Report the cache loading time
    printf("Cache loading time %"PU"\n", in_seconds(rdtsc() - last_ts));
//    lwip_print_interesting_stats();

    /* continue with the web-server initialization. */
    init_callback(); /* do remaining initialization! */
}
Example #2
0
static void mount_callback(void *arg, struct nfs_client *client,
                 enum mountstat3 mountstat, struct nfs_fh3 fhandle)
{
    assert(mountstat == MNT3_OK);
    nfs_root_fh = fhandle; /* GLOBAL: assigning root of filesystem handle */
#ifdef PRELOAD_WEB_CACHE
    DEBUGPRINT ("nfs_mount successful, loading initial cache.\n");
    initial_cache_load(client);	/* Initial load of files for cache. */
#else //     PRELOAD_WEB_CACHE
    DEBUGPRINT ("nfs_mount successful\n");
    init_callback(); /* done! */
#endif // PRELOAD_WEB_CACHE
} /* end function: mount_callback */
Example #3
0
static int test_callback_add_remove(void)
{
	struct device *dev = device_get_binding(DEV_NAME);

	/* SetUp: initialize environment */
	init_callback(dev);

	/* 3. enable callback, trigger PIN_IN interrupt by operate PIN_OUT */
	trigger_callback(dev, 1);
	/*= checkpoint: check callback is triggered =*/
	if (cb_cnt[0] != 1 || cb_cnt[1] != 1) {
		TC_ERROR("not trigger callback correctly\n");
		goto err_exit;
	}

	/* 4. remove callback_1 */
	gpio_remove_callback(dev, &cb_data[0].gpio_cb);
	trigger_callback(dev, 1);

	/*= checkpoint: check callback is triggered =*/
	if (cb_cnt[0] != 0 || cb_cnt[1] != 1) {
		TC_ERROR("not trigger callback correctly\n");
		goto err_exit;
	}

	/* 5. remove callback_2 */
	gpio_remove_callback(dev, &cb_data[1].gpio_cb);
	trigger_callback(dev, 1);
	/*= checkpoint: check callback is triggered =*/
	if (cb_cnt[0] != 0 || cb_cnt[1] != 0) {
		TC_ERROR("not trigger callback correctly\n");
		goto err_exit;
	}
	return TC_PASS;

err_exit:
	gpio_remove_callback(dev, &cb_data[0].gpio_cb);
	gpio_remove_callback(dev, &cb_data[1].gpio_cb);
	return TC_FAIL;
}
Example #4
0
void on_sent(DictionaryIterator *dict, void *context) {
    if (init_callback) init_callback();
    init_callback = NULL;
}
Example #5
0
void SIM_init(){
	sky_pref_t* pref;
	char* welcome_str = get_front_message();
	/* 
	 * get the corrent_config_file and do some initialization 
	 */
	skyeye_config_t* config = get_current_config();
	skyeye_option_init(config);
	/*
	 * initialization of callback data structure, it needs to 
	 * be initialized at very beginning.
	 */
	init_callback();

	/*
	 * initilize the data structure for command
	 * register some default built-in command
	 */
	init_command_list();

	init_stepi();

	/*
	 * initialization of module manangement 
	 */
	init_module_list();

	
	/*
	 * initialization of architecture and cores
	 */
	init_arch();
	
	/*
	 * initialization of bus and memory module
	 */
	init_bus();


	/*
	 * initialization of machine module
	 */
	init_mach();

	
	/*
	 * initialization of breakpoint, that depends on callback module.
	 */
	init_bp();

	/* 
	 * get the current preference for simulator 
	 */
	pref = get_skyeye_pref();

	/* 
	 * loading all the modules in search directory 
	 */
	if(!pref->module_search_dir)
		pref->module_search_dir = skyeye_strdup(default_lib_dir);
	SKY_load_all_modules(pref->module_search_dir, NULL);
	//skyeye_config_t *config;
	//config = malloc(sizeof(skyeye_config_t));
	/*	
	if(pref->autoboot == True){
		SIM_start();
		SIM_run();
	}
	*/
	/*
	 * if we run simulator in GUI or external IDE, we do not need to
	 * launch our CLI.
	 */
	if(pref->interactive_mode == True){
		SIM_cli();		
	}
	else{
		SIM_start();
		SIM_run();
	}
}
Example #6
0
int
ACE_TMAIN(int argc, ACE_TCHAR *argv[])
{
  static const int orb_threads = 5;
  static const int total_threads = 15;

  // It must be ensured that there are more total threads that there are
  // that are dedicated to running the ORB.
  ACE_ASSERT (total_threads > orb_threads);

  Worker worker (orb_threads);
  try
    {
      worker.orb_ =
        CORBA::ORB_init (argc, argv, "test");

      if (parse_args (argc, argv) != 0)
        return 1;

      ACE_DEBUG ((LM_DEBUG,"using ior = %s\n",ior));

      CORBA::Object_var tmp = worker.orb_->string_to_object(ior);

      if (CORBA::is_nil (tmp.in ()))
        {
          ACE_ERROR_RETURN ((LM_ERROR, "Invalid IOR.\n")
                            ,1);
        }
      worker.hello_ = Test::Hello::_narrow(tmp.in ());

      if (CORBA::is_nil (worker.hello_.in ()))
        {
          ACE_ERROR_RETURN ((LM_ERROR,
                             "Nil Test::Hello reference <%s>\n",
                             ior),
                            1);
        }

//       bool x = worker.hello_->_non_existent();
//       ACE_DEBUG ((LM_DEBUG, "_non_existent returned %d\n",x));

      {
        // Set the Synch Scopes

        CORBA::Any scope_as_any;

        ACE_DEBUG ((LM_DEBUG, "(%P|%t) - Applying SYNC_NONE.\n"));
        scope_as_any <<= Messaging::SYNC_NONE;
        CORBA::PolicyList policies (1);
        policies.length (1);
        policies[0] =
          worker.orb_->create_policy (Messaging::SYNC_SCOPE_POLICY_TYPE,
                              scope_as_any);

        ACE_DEBUG ((LM_DEBUG,
                    "(%P|%t) - Applying Synch Scope at Object level.\n"));
        tmp = tmp->_set_policy_overrides (policies, CORBA::SET_OVERRIDE);
        policies[0]->destroy ();
      }

      worker.asynch_hello_ = Test::Hello::_narrow(tmp.in ());

      if (CORBA::is_nil (worker.asynch_hello_.in ())) {
        ACE_ERROR_RETURN ((LM_ERROR,
                           "Nil Test::Hello reference <%s>\n",
                           ior),
                          1);
      }

      init_callback(worker);

    }
  catch (CORBA::Exception &ex)
    {
      ACE_ERROR ((LM_ERROR, "Exception caught: %s\"%s\"\n"
                  , ex._name(), ex._rep_id ()));
      return 1;
    }

  worker.activate (THR_NEW_LWP | THR_JOINABLE, total_threads);
  worker.wait();

  return 0;
}