当前位置: 首页>>代码示例>>C++>>正文


C++ dc_dist_object::dc方法代码示例

本文整理汇总了C++中dc_dist_object::dc方法的典型用法代码示例。如果您正苦于以下问题:C++ dc_dist_object::dc方法的具体用法?C++ dc_dist_object::dc怎么用?C++ dc_dist_object::dc使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在dc_dist_object的用法示例。


在下文中一共展示了dc_dist_object::dc方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: rdtsc

 void run_threaded_string_sends_0(size_t length, size_t numthreads) {
   if (rmi.procid() == 1) {
     rmi.full_barrier();
     return;
   }
   timer ti;
   std::cout << numthreads << " threaded " << SEND_LIMIT_PRINT <<" sends, "
                                           << length << " bytes\n";
   ti.start();
   size_t numsends = SEND_LIMIT / (length * numthreads);
   size_t rd = rdtsc();
   thread_group thrgrp;
   for (size_t i = 0; i < numthreads; ++i) {
     thrgrp.launch(boost::bind(&teststruct::perform_string_sends_0, this, length, numsends));
   }
   thrgrp.join();
   size_t rd2 = rdtsc();
   std::cout << (rd2 - rd) / (numthreads * numsends)  << " cycles per call\n";
   double t1 = ti.current_time();
   rmi.dc().flush();
   double t2 = ti.current_time();
   rmi.full_barrier();
   double t3 = ti.current_time();
   print_res(t1,t2,t3);
 }
开发者ID:JLtW,项目名称:graphlab,代码行数:25,代码来源:rpc_call_perf_test.cpp

示例2: set

    /**
     * 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);
        }
    }
开发者ID:jerrylam,项目名称:GraphLab,代码行数:19,代码来源:dht.hpp

示例3:

 void run_short_sends_0() {
   if (rmi.procid() == 1) {
     rmi.full_barrier();
     return;
   }
   timer ti;
   std::cout << "Single Threaded " << SEND_LIMIT_PRINT << " sends, 4 integer blocks\n";
   ti.start();
   size_t numsends = SEND_LIMIT / (sizeof(size_t) * 4);
   perform_short_sends_0(numsends);
   double t1 = ti.current_time();
   rmi.dc().flush();
   double t2 = ti.current_time();
   rmi.full_barrier();
   double t3 = ti.current_time();
   print_res(t1,t2,t3);
 }
开发者ID:JLtW,项目名称:graphlab,代码行数:17,代码来源:rpc_call_perf_test.cpp

示例4: get

    /**
     * gets the value associated with a key.
     * Returns (true, Value) if the entry is available.
     * Returns (false, undefined) otherwise.
     */
    std::pair<bool, ValueType> get(const KeyType &key) const {
        // who owns the data?

        const size_t hashvalue = hasher(key);
        const size_t owningmachine = hashvalue % rpc.numprocs();
        std::pair<bool, ValueType> retval;
        // if it is me, we can return it
        if (owningmachine == rpc.dc().procid()) {

            lock.lock();
            typename storage_type::const_iterator iter = storage.find(hashvalue);
            retval.first = iter != storage.end();
            if (retval.first) retval.second = iter->second;
            lock.unlock();
        } else {
            retval = rpc.remote_request(owningmachine,
                                        &dht<KeyType,ValueType>::get,
                                        key);
        }
        return retval;
    }
开发者ID:jerrylam,项目名称:GraphLab,代码行数:26,代码来源:dht.hpp

示例5: owner

 /**
  * Get the owner of the key
  */
 procid_t owner(const KeyType& key) const {
     return hasher(key) % rpc.dc().numprocs();
 }
开发者ID:jerrylam,项目名称:GraphLab,代码行数:6,代码来源:dht.hpp


注:本文中的dc_dist_object::dc方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。