Example #1
0
bool LBCommData::equal(const LBCommData &d2) const
{
    if (from_proc()) {
        if (src_proc != d2.src_proc)
            return false;
    } else {
        if (!LDOMidEqual(srcObj.omID(), d2.srcObj.omID())
                || !LDObjIDEqual(srcObj.objID(),d2.srcObj.objID()) )
            return false;
    }
    return (bool)(destObj == d2.destObj);
}
Example #2
0
int BaseLB::LDStats::getHash(const LDObjid &oid, const LDOMid &mid)
{
#if CMK_LBDB_ON
    CmiAssert(hashSize > 0);
    int hash = ObjKey(oid, hashSize);

    for(int id=0;id<hashSize;id++){
        int index = (id+hash)%hashSize;
	if (index == -1 || objHash[index] == -1) return -1;
        if (LDObjIDEqual(objData[objHash[index]].objID(), oid) &&
            LDOMidEqual(objData[objHash[index]].omID(), mid))
            return objHash[index];
    }
    //  CkPrintf("not found \n");
#endif
    return -1;
}
Example #3
0
ObjGraph::Node* ObjGraph::find_node(const LDObjKey &edge_key)
{
  const LDOMid &edge_omid = edge_key.omID();
  const LDObjid &edge_id = edge_key.objID();
  const int from_hashval = calc_hashval(edge_omid,edge_id);
  //  CkPrintf("From = %d\n",from_hashval);
  Node* from_node = node_table[from_hashval];

  while (from_node != 0) {
    const LDOMid omid =
      stats->objData[from_node->index].omID();
    const LDObjid objid =
      stats->objData[from_node->index].objID();
    //    CkPrintf("Comparing %d to %d\n",objid.id[0],edge_id.id[0]);
    if (LDOMidEqual(omid,edge_omid) && LDObjIDEqual(objid,edge_id) )
      break;
    from_node = from_node->nxt_hash;
  }

  return from_node;
}
Example #4
0
void LBDB::Send(const LDOMHandle &destOM, const LDObjid &destid, unsigned int bytes, int destObjProc)
{
  LBCommData* item_ptr;

  if (obj_running) {
    const LDObjHandle &runObj = RunningObj();

    // Don't record self-messages from an object to an object
    if ( LDOMidEqual(runObj.omhandle.id,destOM.id)
	 && LDObjIDEqual(runObj.id,destid) )
      return;

    // In the future, we'll have to eliminate processor to same 
    // processor messages as well

    LBCommData item(runObj,destOM.id,destid, destObjProc);
    item_ptr = commTable->HashInsertUnique(item);
  } else {
    LBCommData item(CkMyPe(),destOM.id,destid, destObjProc);
    item_ptr = commTable->HashInsertUnique(item);
  }  
  item_ptr->addMessage(bytes);
}