Пример #1
0
 void task(size_t i) {
   if (i < 5) std::cout << "Task " << i << std::endl;
   if (i > 0) {
     if (rmi.numprocs() == 1) {
       add_task_local(i - 1);
     }
     else {
       rmi.remote_call((procid_t)((rmi.procid() + 1) % rmi.numprocs()),
                   &simple_engine_test::add_task_local,
                   i - 1);
     }
   }
 }
Пример #2
0
    /**
     * Sets the newval to be the value associated with the key
     */
    void set(const KeyType &key, const ValueType &newval) {
        // who owns the data?
        const size_t hashvalue = hasher(key);
        const size_t owningmachine = hashvalue % rpc.numprocs();

        // if it is me, set it
        if (owningmachine == rpc.dc().procid()) {
            lock.lock();
            storage[hashvalue] = newval;
            lock.unlock();
        } else {
            rpc.remote_call(owningmachine,
                            &dht<KeyType,ValueType>::set,
                            key, newval);
        }
    }
Пример #3
0
 void perform_long_sends_0(size_t length, size_t number) {
   std::vector<size_t> v(length, 5000000);
   for (size_t i = 0;i < number; ++i) {
     rmi.remote_call(1, &teststruct::receive_vector, v);
   }
 }
Пример #4
0
 void perform_string_sends_0(size_t length, size_t number) {
   std::string s(length, 1);
   for (size_t i = 0;i < number; ++i) {
     rmi.remote_call(1, &teststruct::receive_string, s);
   }
 }
Пример #5
0
 void perform_short_sends_0(size_t number) {
   for (size_t i = 0;i < number; ++i) {
     rmi.remote_call(1, &teststruct::receive_ints, 100,100,1000,5000000);
   }
 }