LLFloaterStats::LLFloaterStats(const LLSD& val) : LLFloater("floater_stats"), mStatsContainer(NULL), mScrollContainer(NULL) { LLUICtrlFactory::getInstance()->buildFloater(this, "floater_statistics.xml", NULL, FALSE); LLRect stats_rect(0, getRect().getHeight() - LLFLOATER_HEADER_SIZE, getRect().getWidth() - LLFLOATER_CLOSE_BOX_SIZE, 0); mStatsContainer = new LLContainerView("statistics_view", stats_rect); mStatsContainer->showLabel(FALSE); LLRect scroll_rect(LL_SCROLL_BORDER, getRect().getHeight() - LLFLOATER_HEADER_SIZE - LL_SCROLL_BORDER, getRect().getWidth() - LL_SCROLL_BORDER, LL_SCROLL_BORDER); mScrollContainer = new LLScrollableContainerView(std::string("statistics_scroll"), scroll_rect, mStatsContainer); mScrollContainer->setFollowsAll(); mScrollContainer->setReserveScrollCorner(TRUE); mStatsContainer->setScrollContainer(mScrollContainer); addChild(mScrollContainer); buildStats(); }
void HybridBaseLB::ReceiveStats(CkMarshalledCLBStatsMessage &data, int fromlevel) { #if CMK_LBDB_ON FindNeighbors(); // store the message CLBStatsMsg *m = data.getMessage(); int atlevel = fromlevel + 1; CmiAssert(tree->isroot(CkMyPe(), atlevel)); depositLBStatsMessage(m, atlevel); int &stats_msg_count = levelData[atlevel]->stats_msg_count; stats_msg_count ++; DEBUGF(("[%d] ReceiveStats at level: %d %d/%d\n", CkMyPe(), atlevel, stats_msg_count, levelData[atlevel]->nChildren)); if (stats_msg_count == levelData[atlevel]->nChildren) { // build LDStats buildStats(atlevel); stats_msg_count = 0; int parent = levelData[atlevel]->parent; if (parent != -1) { // combine and shrink message // build a new message based on our LDStats CLBStatsMsg* cmsg = buildCombinedLBStatsMessage(atlevel); // send to parent CkMarshalledCLBStatsMessage marshmsg(cmsg); thisProxy[parent].ReceiveStats(marshmsg, atlevel); } else { // root of all processors, calls top-level strategy (refine) thisProxy[CkMyPe()].Loadbalancing(atlevel); } } #endif }
// Component Character void CEntityBuilder::buildCharacter ( TiXmlElement *pNode, Entity *e, Resources*){ if ( pNode ){ // Check nickname to identify entity std::string nickname ("XXX"); pNode->QueryValueAttribute( "nickname", &nickname); // Parse stats TiXmlElement *pChar = pNode->FirstChildElement("stats"); if ( pChar ){ Character *character = new Character( nickname); for(; pChar; pChar= pChar->NextSiblingElement()){ std::string name; long value(0); if ( TIXML_SUCCESS == pChar->QueryValueAttribute( "name", &name) && TIXML_SUCCESS == pChar->QueryValueAttribute( "value", &value)){ buildStats( character, name, CVariant( value)); } } e->addComponent( character); } } }
void CentralLB::LoadBalance() { #if CMK_LBDB_ON int proc; const int clients = CkNumPes(); #if ! USE_REDUCTION // build data buildStats(); #else for (proc = 0; proc < clients; proc++) statsMsgsList[proc] = NULL; #endif theLbdb->ResetAdaptive(); if (!_lb_args.samePeSpeed()) statsData->normalize_speed(); if (_lb_args.debug()) CmiPrintf("\nCharmLB> %s: PE [%d] step %d starting at %f Memory: %f MB\n", lbname, cur_ld_balancer, step(), start_lb_time, CmiMemoryUsage()/(1024.0*1024.0)); // if we are in simulation mode read data if (LBSimulation::doSimulation) simulationRead(); char *availVector = LBDatabaseObj()->availVector(); for(proc = 0; proc < clients; proc++) statsData->procs[proc].available = (CmiBool)availVector[proc]; preprocess(statsData); // CkPrintf("Before Calling Strategy\n"); if (_lb_args.printSummary()) { LBInfo info(clients); // not take comm data info.getInfo(statsData, clients, 0); LBRealType mLoad, mCpuLoad, totalLoad; info.getSummary(mLoad, mCpuLoad, totalLoad); int nmsgs, nbytes; statsData->computeNonlocalComm(nmsgs, nbytes); CkPrintf("[%d] Load Summary (before LB): max (with bg load): %f max (obj only): %f average: %f at step %d nonlocal: %d msgs %.2fKB.\n", CkMyPe(), mLoad, mCpuLoad, totalLoad/clients, step(), nmsgs, 1.0*nbytes/1024); // if (_lb_args.debug() > 1) { // for (int i=0; i<statsData->n_objs; i++) // CmiPrintf("[%d] %.10f %.10f\n", i, statsData->objData[i].minWall, statsData->objData[i].maxWall); // } } #if CMK_REPLAYSYSTEM LDHandle *loadBalancer_pointers; if (_replaySystem) { loadBalancer_pointers = (LDHandle*)malloc(CkNumPes()*sizeof(LDHandle)); for (int i=0; i<statsData->n_objs; ++i) loadBalancer_pointers[statsData->from_proc[i]] = statsData->objData[i].handle.omhandle.ldb; } #endif LBMigrateMsg* migrateMsg = Strategy(statsData); #if (defined(_FAULT_MLOG_) || defined(_FAULT_CAUSAL_)) migrateMsg->step = step(); #endif #if CMK_REPLAYSYSTEM CpdHandleLBMessage(&migrateMsg); if (_replaySystem) { for (int i=0; i<migrateMsg->n_moves; ++i) migrateMsg->moves[i].obj.omhandle.ldb = loadBalancer_pointers[migrateMsg->moves[i].from_pe]; free(loadBalancer_pointers); } #endif LBDatabaseObj()->get_avail_vector(migrateMsg->avail_vector); migrateMsg->next_lb = LBDatabaseObj()->new_lbbalancer(); // if this is the step at which we need to dump the database simulationWrite(); // calculate predicted load // very time consuming though, so only happen when debugging is on if (_lb_args.printSummary()) { LBInfo info(clients); // not take comm data getPredictedLoadWithMsg(statsData, clients, migrateMsg, info, 0); LBRealType mLoad, mCpuLoad, totalLoad; info.getSummary(mLoad, mCpuLoad, totalLoad); int nmsgs, nbytes; statsData->computeNonlocalComm(nmsgs, nbytes); CkPrintf("[%d] Load Summary (after LB): max (with bg load): %f max (obj only): %f average: %f at step %d nonlocal: %d msgs %.2fKB useMem: %.2fKB.\n", CkMyPe(), mLoad, mCpuLoad, totalLoad/clients, step(), nmsgs, 1.0*nbytes/1024, (1.0*useMem())/1024); for (int i=0; i<clients; i++) migrateMsg->expectedLoad[i] = info.peLoads[i]; } DEBUGF(("[%d]calling recv migration\n",CkMyPe())); #if (defined(_FAULT_MLOG_) || defined(_FAULT_CAUSAL_)) lbDecisionCount++; migrateMsg->lbDecisionCount = lbDecisionCount; #endif envelope *env = UsrToEnv(migrateMsg); if (1) { // broadcast thisProxy.ReceiveMigration(migrateMsg); } else { // split the migration for each processor for (int p=0; p<CkNumPes(); p++) { LBMigrateMsg *m = extractMigrateMsg(migrateMsg, p); thisProxy[p].ReceiveMigration(m); } delete migrateMsg; } // Zero out data structures for next cycle // CkPrintf("zeroing out data\n"); statsData->clear(); stats_msg_count=0; #endif }