您当前的位置:首页 > IT编程 > C++
| C语言 | Java | VB | VC | python | Android | TensorFlow | C++ | oracle | 学术与代码 | cnn卷积神经网络 | gnn | 图像修复 | Keras | 数据集 | Neo4j | 自然语言处理 | 深度学习 | 医学CAD | 医学影像 | 超参数 | pointnet | pytorch | 异常检测 | Transformers | 情感分类 | 知识图谱 |

自学教程:C++ DVLOG函数代码示例

51自学网 2021-06-01 20:24:43
  C++
这篇教程C++ DVLOG函数代码示例写得很实用,希望能帮到您。

本文整理汇总了C++中DVLOG函数的典型用法代码示例。如果您正苦于以下问题:C++ DVLOG函数的具体用法?C++ DVLOG怎么用?C++ DVLOG使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。

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

示例1: function_footprint

void MembershipTableMgr::handleNormalJoinEvent(const MemberWrapper& member) {  function_footprint();  queue.push(member);  if(joining) {    DVLOG(0) << "$$$$$$$$$$$$$$$$$$$$$$$$$$";    DVLOG(0) << "$$$$$$$$$$$$$$$$$$$$$$$$$$";    DVLOG(0) << "current joining member queue size: " << queue.unsafe_size();    DVLOG(0) << "$$$$$$$$$$$$$$$$$$$$$$$$$$";    DVLOG(0) << "$$$$$$$$$$$$$$$$$$$$$$$$$$";    return;  }  while(!queue.empty()) {    joining.store(true);    MemberWrapper joined_member;    queue.try_pop(joined_member);    // leading generate whole member table and send to joining member.    auto wholeMemberTable = std::make_shared<WholeMembershipTableEvent>();    genMembershipTable(*wholeMemberTable->mutable_table());    ResultCode rs;    rs = multicastMemberMessage(WHOLE_MEMBERSHIP_TABLE, wholeMemberTable);    if (rs != RC_SUCCESS) {      LOG(ERROR)<< getErrorDescription(rs);      return;    }    // leading send delta member to all members.    auto deltaMember = std::make_shared<DeltaMemberEvent>();    deltaMember->set_position(findAddPos());    deltaMember->mutable_member()->CopyFrom(joined_member.getMember());    rs = multicastMemberMessage(DELTA_MEMBER_AND_JOIN_POSITION, deltaMember);    if (rs != RC_SUCCESS) {      LOG(ERROR)<< getErrorDescription(rs);      return;    }  }}
开发者ID:XiaominZhang,项目名称:raf,代码行数:35,


示例2: serialize

    void serialize( Archive & ar, const unsigned int version )    {        DVLOG(2) << "[BDF::serialize] serialize BDFBase/n";#if 0        ar & M_order;        ar & M_name;        ar & M_time;        ar & M_n_restart;        ar & M_Tf;#endif        //ar & M_time_orders;        ar & boost::serialization::make_nvp( "time_values", M_time_values_map );        //DVLOG(2) << "[BDF::serialize] time orders size: " << M_time_orders.size() << "/n";        DVLOG(2) << "[BDF::serialize] time values size: " << M_time_values_map.size() << "/n";        for ( auto it = M_time_values_map.begin(), en = M_time_values_map.end(); it!=en; ++it )        {            //LOG(INFO) << "[Bdf] order " << i << "=" << M_time_orders[i] << "/n";            DVLOG(2) << "[Bdf::serialize] value " << *it << "/n";        }        DVLOG(2) << "[BDF::serialize] serialize BDFBase done/n";    }
开发者ID:TrojanXu,项目名称:feelpp,代码行数:27,


示例3: CHECK

A_Entry GlobalQueue<T>::push_reserve ( bool ignore ) {  CHECK( isMaster() );  Grappa::Metrics::global_queue_stats.record_push_reserve_reply( Grappa_sizeof_delegate_func_reply< bool, A_Entry >() );  DVLOG(5) << "push_reserve";  CHECK( capacity > 0 );  if ( (tail % capacity == head % capacity) && (tail != head) ) {    return make_global( static_cast< QueueEntry<T> * >( NULL ) ); // no room  } else {    A_Entry assigned = queueBase + (tail % capacity);     tail++;    // if there are any consumers, wake oldest and give the address just produced    if ( pullReserveWaiters.size() > 0 ) {      CHECK( head == tail-1 ) << "Size should be exactly one, since there are waiters and one value was just produced";      DVLOG(5) << "push_reserve: found waiters";      A_Entry granted = assigned;      head++;      A_D_A_Entry w = pullReserveWaiters.front();      pullReserveWaiters.pop();      pull_reserve_sendreply( w, &granted, true );    }    return assigned;  }}
开发者ID:kawuum,项目名称:grappa,代码行数:31,


示例4: UpdateComponent

    static void UpdateComponent( spaceT const& Xh, Epetra_MultiVector& sol, Epetra_MultiVector& comp )    {        Epetra_Map componentMap ( epetraMap( Xh->template functionSpace<index>()->map() ) );        Epetra_Map globalMap ( epetraMap( Xh->map() ) );        int shift = Xh->nDofStart( index );        int Length = comp.MyLength();        for ( int i=0; i < Length; i++ )        {            int compGlobalID = componentMap.GID( i );            if ( compGlobalID >= 0 )            {                int compLocalID = componentMap.LID( compGlobalID );                int localID = globalMap.LID( compGlobalID+shift );                //                         int globalID = globalMap.GID(localID);                DVLOG(2) << "Copy entry component[" << compLocalID << "] to sol[" << localID << "]="                               <<  sol[0][localID]                               << "]/n";                sol[0][localID] = comp[0][compLocalID] ;                DVLOG(2) << comp[0][compLocalID] << "/n";            }        }    }
开发者ID:TrojanXu,项目名称:feelpp,代码行数:30,


示例5: DVLOG

void StoreDelegateRddActor::handleRddCreate(const ActorMessagePtr& msg) {  DVLOG(2) << "StoreDelegateRddActor : handle create store delegate.";  rawMsg = msg;  CreateDelegateRddRequest* request = dynamic_cast<CreateDelegateRddRequest*>(msg->getPayload().get());  idgs::store::MetadataHelper::loadStoreMetadata(request->store_name(), metadata.get());  ClusterFramework& cluster = ::idgs::util::singleton<ClusterFramework>::getInstance();  for (int32_t partition = 0; partition < partitionSize; ++partition) {    int32_t memberId = cluster.getPartitionManager()->getPartition(partition)->getPrimaryMemberId();    shared_ptr<CreateDelegatePartitionRequest> payload(new CreateDelegatePartitionRequest);    payload->set_store_name(request->store_name());    payload->set_partition(partition);    payload->set_rdd_name(getRddName());    ActorMessagePtr reqMsg = createActorMessage();    reqMsg->setOperationName(CREATE_DELEGATE_PARTITION);    reqMsg->setDestActorId(RDD_SERVICE_ACTOR);    reqMsg->setDestMemberId(memberId);    reqMsg->setPayload(payload);    DVLOG(3) << "RDD /"" << getRddName() << "/" sending create RDD partition to member " << memberId;    ::idgs::actor::postMessage(reqMsg);  }}
开发者ID:XiaominZhang,项目名称:raf,代码行数:26,


示例6: DVLOG

typename BackendPetsc<T>::solve_return_typeBackendPetsc<T>::solve( sparse_matrix_type const& A,                        vector_type& x,                        vector_type const& b ){    M_solver_petsc.setPrefix( this->prefix() );    M_solver_petsc.setPreconditionerType( this->pcEnumType() );    M_solver_petsc.setSolverType( this->kspEnumType() );    if (!M_solver_petsc.initialized())        M_solver_petsc.attachPreconditioner( this->M_preconditioner );    M_solver_petsc.setConstantNullSpace( this->hasConstantNullSpace() );    M_solver_petsc.setFieldSplitType( this->fieldSplitEnumType() );    M_solver_petsc.setTolerances( _rtolerance=this->rTolerance(),                                  _atolerance=this->aTolerance(),                                  _dtolerance=this->dTolerance(),                                  _maxit = this->maxIterations() );    M_solver_petsc.setPrecMatrixStructure( this->precMatrixStructure() );    M_solver_petsc.setMatSolverPackageType( this->matSolverPackageEnumType() );    M_solver_petsc.setShowKSPMonitor( this->showKSPMonitor() );    M_solver_petsc.setShowKSPConvergedReason( this->showKSPConvergedReason() );    auto res = M_solver_petsc.solve( A, x, b, this->rTolerance(), this->maxIterations() );    DVLOG(2) << "[BackendPetsc::solve] number of iterations : " << res.template get<1>() << "/n";    DVLOG(2) << "[BackendPetsc::solve]             residual : " << res.template get<2>() << "/n";    if ( !res.template get<0>() )        LOG(ERROR) << "Backend " << this->prefix() << " : linear solver failed to converge" << std::endl;    return res;} // BackendPetsc::solve
开发者ID:TrojanXu,项目名称:feelpp,代码行数:30,


示例7: complete

 /// Mark a certain number of things completed. When the global count on all cores goes to 0, all /// tasks waiting on the GCE will be woken. /// /// Note: this can be called in a message handler (e.g. remote completes from stolen tasks). void complete(int64_t dec = 1) {   count -= dec;   DVLOG(4) << "complete (" << count << ") -- gce(" << this << ")";      // out of work here   if (count == 0) { // count[dec -> 0]     // enter cancellable barrier     send_heap_message(master_core, [this] {       cores_out--;       DVLOG(4) << "core entered barrier (cores_out:"<< cores_out <<")";              // if all are in       if (cores_out == 0) { // cores_out[1 -> 0]         CHECK_EQ(count, 0);         // notify everyone to wake         for (Core c = 0; c < cores(); c++) {           send_heap_message(c, [this] {             CHECK_EQ(count, 0);             DVLOG(3) << "broadcast";             broadcast(&cv); // wake anyone who was waiting here             reset(); // reset, now anyone else calling `wait` should fall through           });         }       }     });   } }
开发者ID:gfarnadi,项目名称:grappa,代码行数:31,


示例8: try_merge_buddy_recursive

  void try_merge_buddy_recursive( ChunkMap::iterator cmit ) {    // compute address of buddy    intptr_t address = cmit->second.address;    intptr_t buddy_address = (address ^ cmit->second.size);    DVLOG(5) << cmit->second << " buddy address " << (void *) buddy_address;    // does it exist?    ChunkMap::iterator buddy_iterator = chunks_.find( buddy_address );    if( buddy_iterator != chunks_.end() &&         buddy_iterator->second.size == cmit->second.size &&        buddy_iterator->second.in_use == false ) {      DVLOG(5) << "buddy found! address " << (void *) address << " buddy address " << (void *) buddy_address;      // remove the higher-addressed chunk      ChunkMap::iterator higher_iterator = address < buddy_address ? buddy_iterator : cmit;      remove_from_free_list( higher_iterator );      chunks_.erase( higher_iterator );      // keep the the lower-addressed chunk in the map:      // update its size and move it to the right free list      ChunkMap::iterator lower_iterator = address < buddy_address ? cmit : buddy_iterator;      remove_from_free_list( lower_iterator ); // should these be swapped? I think so.      lower_iterator->second.size *= 2;      add_to_free_list( lower_iterator );      // see if we have more to merge      try_merge_buddy_recursive( lower_iterator );    }  }
开发者ID:kawuum,项目名称:grappa,代码行数:29,


示例9: block_until_acquired

  void block_until_acquired() {    if( !acquired_ ) {      start_acquire();#ifdef VTRACE_FULL      VT_TRACER("incoherent block_until_acquired");#endif      DVLOG(5) << "Worker " << Grappa::current_worker()               << " ready to block on " << *request_address_               << " * " << *count_ ;      if( !acquired_ ) {        start_time_ = Grappa::timestamp();      } else {        start_time_ = 0;      }      while( !acquired_ ) {      DVLOG(5) << "Worker " << Grappa::current_worker()               << " blocking on " << *request_address_               << " * " << *count_ ;        if( !acquired_ ) {          thread_ = Grappa::current_worker();          Grappa::suspend();          thread_ = NULL;        }        DVLOG(5) << "Worker " << Grappa::current_worker()                  << " woke up for " << *request_address_                  << " * " << *count_ ;      }      IAMetrics::record_wakeup_latency( start_time_, network_time_ );    }  }
开发者ID:HPCProjectsTry,项目名称:grappa,代码行数:30,


示例10: getComponent

    static Epetra_MultiVector getComponent( spaceT const& Xh, Epetra_MultiVector const& sol )    {        Epetra_Map componentMap ( epetraMap( Xh->template functionSpace<index>()->map() ) );        Epetra_Map globalMap ( epetraMap( Xh->map() ) );        //DVLOG(2) << "Component map: " << componentMap << "/n";        Epetra_MultiVector component( componentMap, 1 );        int Length = component.MyLength();        int shift = Xh->nDofStart( index );        for ( int i=0; i < Length; i++ )        {            int compGlobalID = componentMap.GID( i );            if ( compGlobalID >= 0 )            {                int compLocalID = componentMap.LID( compGlobalID );                int localID = globalMap.LID( compGlobalID+shift );                //                         int globalID = globalMap.GID(localID);                DVLOG(2) << "[MyBackend] Copy entry sol[" << localID << "]=" <<  sol[0][localID]                               << " to component[" << compLocalID << "]/n";                component[0][compLocalID] = sol[0][localID];                DVLOG(2) << component[0][compLocalID] << "/n";            }        }        return component;    }
开发者ID:TrojanXu,项目名称:feelpp,代码行数:35,


示例11: block_until_pop

 T * block_until_pop() {     DVLOG(5) << __PRETTY_FUNCTION__ << "/" << this << ": blocking until pop with " << s_.get_value() << " now";     s_.decrement();     T * result = ptrs_[s_.get_value()];     DVLOG(5) << __PRETTY_FUNCTION__ << "/" << this << ": finished blocking until pop with " << s_.get_value() << "/" << result;     return result; }
开发者ID:zmahdavi,项目名称:grappa,代码行数:7,


示例12: DVLOG

uint32_t InnerTcpConnection::connect(uint32_t memberId, int retry) {  InnerTcpConnectionState expectedState = INITIAL;  if(!state.compare_exchange_strong(expectedState, CONNECTING)) {    DVLOG(2) << "Already connecting to remote peer: " << memberId;    return 0;  }  setPeerMemberId(memberId);  /// connect to remote peer  auto ep = ::idgs::util::singleton<idgs::actor::RpcFramework>::getInstance().getNetwork()->getEndPoint(memberId);  if(ep == NULL) {    LOG(ERROR) << "Network endpoint of member " << memberId << " is not available.";    terminate();    return RC_CLIENT_SERVER_IS_NOT_AVAILABLE;  }  auto& end_point = ep->tcpEndPoint;  DVLOG(0) << "Connecting to remote peer " << memberId << '(' << end_point << ")";  auto conn = shared_from_this();  try {    socket.async_connect(end_point, [conn, retry](const asio::error_code& error) {      conn->handleConnect(error, retry);    });  } catch (std::exception& e) {    LOG(ERROR) << "Failed to connect to remote peer " << memberId << ", exception: " << e.what();    terminate();  }  return 0;}
开发者ID:XiaominZhang,项目名称:raf,代码行数:28,


示例13: DVLOG

bool PartionManagableNode::processGetPartitionTableReq(OperationContext& context) {  if (!checkOperationName(context, ADMIN_GET_REQUEST)) {    return false;  }  idgs::Application& app = ::idgs::util::singleton<idgs::Application>::getInstance();  PartitionTableMgr* pm = app.getPartitionManager();  idgs::pb::PartitionTable table;  pm->genPartitionTable(table);  DVLOG(4) << "get Partition Table:/n" << table.DebugString();  string jsonBody = protobuf::JsonMessage::toJsonString(&table);  DVLOG(3) << "get json for partition table :/n" << jsonBody;  std::shared_ptr<idgs::actor::ActorMessage> resposne =      idgs::admin::util::createAdminResponse(context,          ::idgs::admin::pb::Success,           jsonBody);  idgs::actor::sendMessage(resposne);  return true;}
开发者ID:XiaominZhang,项目名称:raf,代码行数:25,


示例14: SplitStringIntoKeyValues

    bool SplitStringIntoKeyValues(        const std::string& line,        char key_value_delimiter,        std::string* key,        std::vector<std::string>* values)    {        key->clear();        values->clear();        // 查找key.        size_t end_key_pos = line.find_first_of(key_value_delimiter);        if(end_key_pos == std::string::npos)        {            DVLOG(1) << "cannot parse key from line: " << line;            return false; // 没有key.        }        key->assign(line, 0, end_key_pos);        // 查找values.        std::string remains(line, end_key_pos, line.size()-end_key_pos);        size_t begin_values_pos = remains.find_first_not_of(key_value_delimiter);        if(begin_values_pos == std::string::npos)        {            DVLOG(1) << "cannot parse value from line: " << line;            return false; // 没有value.        }        std::string values_string(remains, begin_values_pos,            remains.size()-begin_values_pos);        // 添加到vector.        values->push_back(values_string);        return true;    }
开发者ID:abyvaltsev,项目名称:putty-nd3.x,代码行数:33,


示例15: enroll

 /// Enroll more things that need to be completed before the global completion is, well, complete. /// This will send a cancel to the master if this core previously entered the cancellable barrier. /// /// Blocks until cancel completes (if it must cancel) to ensure correct ordering, therefore /// cannot be called from message handler. void enroll(int64_t inc = 1) {   if (inc == 0) return;      CHECK_GE(inc, 1);   count += inc;   DVLOG(5) << "enroll " << inc << " -> " << count << " gce("<<this<<")";      // first one to have work here   if (count == inc) { // count[0 -> inc]     event_in_progress = true; // optimization to save checking in wait()     // cancel barrier     Core co = impl::call(master_core, [this] {       cores_out++;       return cores_out;     });     // first one to cancel barrier should make sure other cores are ready to wait     if (co == 1) { // cores_out[0 -> 1]       event_in_progress = true;       call_on_all_cores([this] {         event_in_progress = true;       });       CHECK(event_in_progress);     }     // block until cancelled     CHECK_GT(count, 0);     DVLOG(2) << "gce(" << this << " cores_out: " << co << ", count: " << count << ")";   } }
开发者ID:gfarnadi,项目名称:grappa,代码行数:33,


示例16: lookup

 bool lookup ( K key ) {   ++hashset_lookup_ops;   if (FLAGS_flat_combining) {     ResultEntry re{false,nullptr};     DVLOG(3) << "lookup[" << key << "] = " << &re;          proxy.combine([&re,key,this](Proxy& p){       // if (p.keys_to_insert.count(key) > 0) {       //   ++hashset_matched_lookups;       //   re.result = true;       //   return FCStatus::SATISFIED;       // } else {         if (p.lookups.count(key) == 0) p.lookups[key] = nullptr;         re.next = p.lookups[key];         p.lookups[key] = &re;         DVLOG(3) << "p.lookups[" << key << "] = " << &re;         return FCStatus::BLOCKED;       // }     });     return re.result;   } else {     ++hashset_lookup_msgs;     return delegate::call(base+computeIndex(key), [key](Cell* c){       for (auto& e : c->entries) if (e.key == key) return true;       return false;     });   } }
开发者ID:HPCProjectsTry,项目名称:grappa,代码行数:28,


示例17: readFF

 T readFF(GlobalAddress<FullEmpty<T>> fe_addr) {   if (fe_addr.core() == mycore()) {     DVLOG(2) << "local";     return fe_addr.pointer()->readFF();   }      FullEmpty<T> result;   auto result_addr = make_global(&result);      send_message(fe_addr.core(), [fe_addr,result_addr]{     auto& fe = *fe_addr.pointer();          if (fe.full()) {       // DVLOG(2) << "no need to block";       fill_remote(result_addr, fe.readFF());       return;     }          DVLOG(2) << "setting up to block (" << fe_addr << ")";     auto* c = SuspendedDelegate::create([&fe,result_addr]{       VLOG(0) << "suspended_delegate!";       fill_remote(result_addr, fe.readFF());     });     add_waiter(&fe, c);   });      return result.readFF(); }
开发者ID:HPCProjectsTry,项目名称:grappa,代码行数:28,


示例18: isParentMeshOf

 //! /return true if the mesh is related to the mesh /p m bool isParentMeshOf( boost::shared_ptr<MeshBase> m ) const     {         DVLOG(4) << "isParentMeshOf<mesh_ptrtype> called/n";         bool res = m->isSubMeshFrom( this );         if ( res == false ) return res;         DVLOG(4) << "this isParentMeshOf m: " << res << "/n";         return res;     }
开发者ID:TrojanXu,项目名称:feelpp,代码行数:9,


示例19: isSubMeshFrom

 //! /return true if the mesh is related to the mesh /p m bool isSubMeshFrom( MeshBase const* m ) const     {         DVLOG(4) << "isSubMeshFrom<mesh_ptrtype> called/n";         if ( !M_smd ) return false;         bool res= (M_smd->mesh.get() == m);         DVLOG(4) << "this isSubMeshFrom m: " << res << "/n";         return res;     }
开发者ID:TrojanXu,项目名称:feelpp,代码行数:9,


示例20: isSiblingOf

 //! /return true if the mesh is related to the mesh /p m bool isSiblingOf( boost::shared_ptr<MeshBase> m ) const     {         DVLOG(4) << "isSibling<mesh_ptrtype> called/n";         if ( !M_smd || !m->hasSubMeshData() ) return false;         bool res = M_smd->mesh.get() == m->M_smd->mesh.get();         if ( res == false ) return res;         DVLOG(4) << "this isSibling m: " << res << "/n";         return res;     }
开发者ID:TrojanXu,项目名称:feelpp,代码行数:10,


示例21: remote_malloc

 /// delegate malloc static GlobalAddress< void > remote_malloc( size_t size_bytes ) {   // ask node 0 to allocate memory   auto allocated_address = Grappa::impl::call( 0, [size_bytes] {       DVLOG(5) << "got malloc request for size " << size_bytes;       GlobalAddress< void > a = global_allocator->local_malloc( size_bytes );       DVLOG(5) << "malloc returning pointer " << a.pointer();       return a;     });   return allocated_address; }
开发者ID:gfarnadi,项目名称:grappa,代码行数:11,


示例22: try_push

 bool try_push( T * buf ) {     DVLOG(5) << __PRETTY_FUNCTION__ << "/" << this << ": trying to push " << buf << " with " << s_.get_value() << " already";     if( s_.get_value() < max_count ) {         push(buf);         DVLOG(5) << __PRETTY_FUNCTION__ << "/" << this << ": succeeded; pushed " << buf << " with " << s_.get_value() << " now";         return true;     } else {         return false;     } }
开发者ID:zmahdavi,项目名称:grappa,代码行数:10,


示例23: try_pop

 T * try_pop() {     DVLOG(5) << __PRETTY_FUNCTION__ << "/" << this << ": trying to pop with " << s_.get_value() << " now";     if( s_.try_decrement() ) {         T * t = ptrs_[ s_.get_value() ];         DVLOG(5) << __PRETTY_FUNCTION__ << "/" << this << ": succeeded; popping " << t << " with " << s_.get_value() << " now";         return t;     } else {         return NULL;     } }
开发者ID:zmahdavi,项目名称:grappa,代码行数:10,


示例24: adjs

LocalMapGraph::LocalMapGraph (std::unordered_set<Edge, Edge_hasher>& edges) : adjs() {  // assume that the vertex ids are not compressed  DVLOG(5) << "local construction: ";  for (auto e : edges) {    DVLOG(5) << "  " << e;    auto& val = adjs[e.src];    val.insert(e.dst);  }}
开发者ID:HPCProjectsTry,项目名称:grappa,代码行数:10,


示例25: check_serstr_dearray

 /// ser to string, de by array void check_serstr_dearray(const Message* src, Message* dest) {   std::string serde_str;   ProtoSerdes<PB_BINARY>::serialize(src, &serde_str);   DVLOG(5) << dumpBinaryBuffer2(serde_str.c_str(), serde_str.length());   ProtoSerdes<PB_BINARY>::deserializeFromArray(serde_str.c_str(), serde_str.length(), dest);   if(src->DebugString().compare(dest->DebugString())) {     LOG(FATAL) << "/nexpect: " << src->DebugString() << "/nactual: " << dest->DebugString();   }   DVLOG(5) << dest->DebugString(); }
开发者ID:XiaominZhang,项目名称:raf,代码行数:11,


示例26: assert_mcs_aligned

void ThreadPimpl::mcs_release_lock(xct::McsLock* mcs_lock, xct::McsBlockIndex block_index) {  assorted::memory_fence_acq_rel();  assert_mcs_aligned(mcs_lock);  ASSERT_ND(mcs_lock->is_locked());  ASSERT_ND(block_index > 0);  ASSERT_ND(current_xct_.get_mcs_block_current() >= block_index);  xct::McsBlock* block = mcs_blocks_ + block_index;  ASSERT_ND(!block->waiting_);  ASSERT_ND(block->lock_addr_tag_ == mcs_lock->last_1byte_addr());  if (block->successor_block_ == 0) {    // okay, successor "seems" nullptr (not contended), but we have to make it sure with atomic CAS    uint32_t expected = xct::McsLock::to_int(id_, block_index);    uint32_t* address = &(mcs_lock->data_);    assert_mcs_aligned(address);#if defined(__GNUC__)    // GCC's builtin atomic. maybe a bit faster because we don't have to give an address of expected    bool swapped = __sync_bool_compare_and_swap(address, expected, 0);#else  // defined(__GNUC__)    bool swapped = assorted::raw_atomic_compare_exchange_strong<uint32_t>(address, &expected, 0);#endif  // defined(__GNUC__)    if (swapped) {      // we have just unset the locked flag, but someone else might have just acquired it,      // so we can't put assertion here.      ASSERT_ND(id_ == 0 || mcs_lock->get_tail_waiter() != id_);      DVLOG(2) << "Okay, release a lock uncontended. me=" << id_;      assorted::memory_fence_acq_rel();      return;    }    DVLOG(0) << "Interesting contention on MCS release. I thought it's null, but someone has just "      " jumped in. me=" << id_ << ", mcs_lock=" << *mcs_lock;    // wait for someone else to set the successor    ASSERT_ND(mcs_lock->is_locked());    uint64_t spins = 0;    while (block->successor_block_ == 0) {      ASSERT_ND(mcs_lock->is_locked());      if (((++spins) & 0xFFFFFFU) == 0) {        assorted::spinlock_yield();      }      assorted::memory_fence_acquire();      continue;    }  }  DVLOG(1) << "Okay, I have a successor. me=" << id_ << ", succ=" << block->successor_;  ASSERT_ND(block->successor_ != id_);  ThreadRef* successor = engine_->get_thread_pool()->get_thread_ref(block->successor_);  ASSERT_ND(successor->get_control_block()->mcs_block_current_ >= block->successor_block_);  xct::McsBlock* succ_block = successor->get_mcs_blocks() + block->successor_block_;  ASSERT_ND(succ_block->lock_addr_tag_ == mcs_lock->last_1byte_addr());  ASSERT_ND(succ_block->waiting_);  ASSERT_ND(mcs_lock->is_locked());  assorted::memory_fence_acq_rel();  succ_block->waiting_ = false;  assorted::memory_fence_acq_rel();}
开发者ID:kumagi,项目名称:foedus_code,代码行数:55,



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


C++ DWARF_SET_ERROR函数代码示例
C++ DVK函数代码示例
万事OK自学网:51自学网_软件自学网_CAD自学网自学excel、自学PS、自学CAD、自学C语言、自学css3实例,是一个通过网络自主学习工作技能的自学平台,网友喜欢的软件自学网站。