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


C++ Probe类代码示例

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


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

示例1: GenProbeSequenceTemplate

    void GenProbeSequenceTemplate (ProbeSequence &seq, unsigned M, unsigned T)
    {
        ProbeSequence scores;
        GenExpectScores(scores, M);
        assert(T > 0);

        std::priority_queue<Probe, std::vector<Probe>, ProbeGT> heap;
        Probe init;
        init.mask = init.shift = 0;
        init.score = 0;
        init.reserve = 0;
        heap.push(init);

        seq.clear();

        for (;;)
        {
            if (heap.empty()) break;
            seq.push_back(heap.top());
            if (seq.size() == T) break;

            Probe shift = heap.top();
            heap.pop();

            for (unsigned next = shift.reserve; next < 2 * M; ++next)
            {
                if (!shift.conflict(scores[next]))
                {
                    Probe tmp = shift + scores[next];
                    tmp.reserve = next + 1;
                    heap.push(tmp);
                }
            }
        }
    }
开发者ID:ZhouJiaLinmumu,项目名称:idmlib,代码行数:35,代码来源:mplsh.cpp

示例2: ClassAdAssign

int ClassAdAssign(ClassAd & ad, const char * pattr, const Probe& probe) 
{
   MyString attr;
   attr.sprintf("%sCount", pattr);
   ad.Assign(attr.Value(), probe.Count);

   attr.sprintf("%sSum", pattr);
   int ret = ad.Assign(attr.Value(), probe.Sum);

   if (probe.Count > 0)
      {
      attr.sprintf("%sAvg", pattr);
      ad.Assign(attr.Value(), probe.Avg());

      attr.sprintf("%sMin", pattr);
      ad.Assign(attr.Value(), probe.Min);

      attr.sprintf("%sMax", pattr);
      ad.Assign(attr.Value(), probe.Max);

      attr.sprintf("%sStd", pattr);
      ad.Assign(attr.Value(), probe.Std());
      }
   return ret;
}
开发者ID:,项目名称:,代码行数:25,代码来源:

示例3: CreateProbes

// maak probes
int Circuit::CreateProbes(std::vector<std::string> Probes)
{
	pView->Print("Create probes!");
	try
	{
		for (int i = 0; i < Probes.size(); i++)
		{
			// maak een probe
			Probe *pProbe = (Probe *)Factory::instance()->RequestComponent(_PROBE);

			if (pProbe != nullptr)
			{
				// zet de probe id.
				pProbe->SetId(Probes.at(i).substr(0, Probes.at(i).find(":")));
				this->Probes.push_back(pProbe);
			}
			else
				throw 1;
		}
	}
	catch (int e)
	{
		// probe error
		return ErrorFound("Error in creating probes!");
	}

	return 1;
}
开发者ID:vegatarier,项目名称:DP1_Sam_Timo,代码行数:29,代码来源:Circuit.cpp

示例4: DYSECTWARN

DysectAPI::DysectErrorCode Backend::relayPacket(PacketPtr* packet, int tag, Stream* stream) {

  if(tag == DysectGlobalReadyTag){
    // Stream to respond when all streams have been bound
    if(controlStream != 0) {
      return DYSECTWARN(Error, "Control stream already set");
    }

    controlStream = stream;

    if((state == ready) && (!streamBindAckSent)) {
      ackBindings();
    }

    return OK;
  }

  switch(state) {
    case bindingStreams:
    {
      if(Domain::isInitTag(tag)) {
        if(bindStream(tag, stream) != OK) {
          return DYSECTWARN(StreamError, "Failed to bind stream!");
        }
      } else {
        assert(!"Save packet until all streams have been bound to domains - not yet supported");
      }
    }
    break;
    case ready:
    {
      if(tag == DysectGlobalStartTag) {
        enableProbeRoots();
      } else {
        if(Domain::isContinueTag(tag)) {

          Domain* dom = 0;
          if(!Domain::getDomainFromTag(dom, tag)) {
            DYSECTWARN(false, "Domain for tag %x could not be found", tag);
          } else {
            Probe* probe = dom->owner;
            if(!probe) {
              DYSECTWARN(false, "Probe for tag %x could not be found", tag);
            } else {
              DYSECTVERBOSE(true, "Handling packet for probe %x", probe->getId());
            }
          }
        }
      }
    }
    break;
    default:
      return InvalidSystemState;
    break;
  }

  return OK;
}
开发者ID:SteveXiSong,项目名称:STAT,代码行数:58,代码来源:backend.cpp

示例5:

std::vector<double> Probes::get_probes_component_and_snapshot(std::size_t comp, std::size_t i)
{
  std::vector<double> vals;  
  for (std::size_t j = 0; j < local_size(); j++)
  {
    Probe* probe = (Probe*) _allprobes[j].second;
    vals.push_back(probe->get_probe_component_and_snapshot(comp, i));
  }
  return vals;
}
开发者ID:BijanZarif,项目名称:fenicstools,代码行数:10,代码来源:Probes.cpp

示例6: pthread_mutex_lock

DysectAPI::DysectErrorCode Backend::handleTimerActions() {
  pthread_mutex_lock(&probesPendingActionMutex);
  if (probesPendingAction.size() > 0) {
    DYSECTVERBOSE(true, "Handle timer actions");
    vector<Probe*>::iterator probeIter = probesPendingAction.begin();
    for(;probeIter != probesPendingAction.end(); probeIter++) {
      Probe* probe = *probeIter;
      Domain* dom = probe->getDomain();

      DYSECTVERBOSE(true, "Sending enqueued actions for timed probe: %x", dom->getId());
      probe->sendEnqueuedActions();

      if(probe->numWaitingProcs() > 0) {
        ProcessSet::ptr lprocset = probe->getWaitingProcs();
        probe->enableChildren(lprocset);
        if(probe->getLifeSpan() == fireOnce)
          probe->disable(lprocset);
        lprocset->continueProcs();
        probe->releaseWaitingProcs();
      }
    }
    probesPendingAction.clear();
  }
  pthread_mutex_unlock(&probesPendingActionMutex);
  return OK;
}
开发者ID:SteveXiSong,项目名称:STAT,代码行数:26,代码来源:backend.cpp

示例7: broadcastStreamInits

DysectAPI::DysectErrorCode Frontend::broadcastStreamInits() {
  vector<Probe*>& roots = ProbeTree::getRoots();
  long numRoots = roots.size();
  
  for(int i = 0; i < numRoots; i++) {
    Probe* probe = roots[i];
    probe->broadcastStreamInit(recursive);
  }

  return OK;

}
开发者ID:LLNL,项目名称:DysectAPI,代码行数:12,代码来源:frontend.cpp

示例8: enableChildren

DysectAPI::DysectErrorCode Probe::enableChildren(ProcessSet::ptr procset) {
  if(linked.empty()) {
    return OK;
  }

  vector<Probe*>::iterator probeIter = linked.begin();
  for(;probeIter != linked.end(); probeIter++) {
    Probe* probe = *probeIter;
    probe->enable(procset);
  }

  return OK;
}
开发者ID:SteveXiSong,项目名称:STAT,代码行数:13,代码来源:probe_be.cpp

示例9: assert

void Probes::set_probes_from_ids(const Array<double>& u)
{
  assert(u.size() == local_size() * value_size());
  
  Array<double> _u(value_size());
  for (std::size_t i = 0; i < local_size(); i++)
  {
    Probe* probe = (Probe*) _allprobes[i].second;
    for (std::size_t j=0; j<value_size(); j++)
      _u[j] = u[i*value_size() + j];
    probe->restart_probe(_u);
  }
}
开发者ID:BijanZarif,项目名称:fenicstools,代码行数:13,代码来源:Probes.cpp

示例10: handleTimerEvents

DysectAPI::DysectErrorCode Backend::handleTimerEvents() {
  if(SafeTimer::anySyncReady()) {
    Err::verbose(true, "Handle timer events");
    vector<Probe*> readyProbes = SafeTimer::getAndClearSyncReady();
    vector<Probe*>::iterator probeIter = readyProbes.begin();

    for(;probeIter != readyProbes.end(); probeIter++) {
      Probe* probe = *probeIter;
      Domain* dom = probe->getDomain();
      
      Err::verbose(true, "Sending enqueued notifications for timed probe: %x", dom->getId());

      probe->sendEnqueuedNotifications();
      probe->sendEnqueuedActions();
    }
  }

  return OK;
}
开发者ID:LLNL,项目名称:DysectAPI,代码行数:19,代码来源:backend.cpp

示例11: Probe

// Single entry for debug daemon
DysectStatus DysectAPI::onProcStart() {
  
  /* Probe creation */
  Probe* foo    = new Probe(Code::location("foo"),
                            Domain::world(1000),
                            Act::stat(AllProcs));
  
  Probe* square    = new Probe(Code::location("square<int>"),
                               Domain::inherit(2000),
                               Act::trace("At square"));

  /* Event chain */
  foo->link(square);

  /* Setup probe tree */
  ProbeTree::addRoot(foo); 

  return DysectOK;
}
开发者ID:SteveXiSong,项目名称:STAT,代码行数:20,代码来源:sess-02.cpp

示例12: enableProbeRoots

DysectAPI::DysectErrorCode Backend::enableProbeRoots() {
  if(Backend::pauseApplication() != OK) {
    return Err::warn(Error, "Could not pause application!");
  }

  vector<Probe*> roots = ProbeTree::getRoots();

  for(int i = 0; i < roots.size(); i++) {
    Probe* probe = roots[i];

    probe->enable();
  }

  if(Backend::resumeApplication() != OK) {
    return Err::warn(Error, "Could not pause application!");
  }

  return OK;
}
开发者ID:LLNL,项目名称:DysectAPI,代码行数:19,代码来源:backend.cpp

示例13: pthread_mutex_init

DysectAPI::DysectErrorCode Backend::enableProbeRoots() {
  pthread_mutex_init(&probesPendingActionMutex, NULL);
  if(Backend::pauseApplication() != OK) {
    return DYSECTWARN(Error, "Could not pause application!");
  }

  vector<Probe*> roots = ProbeTree::getRoots();

  for(int i = 0; i < roots.size(); i++) {
    Probe* probe = roots[i];

    probe->enable();
  }

  if(Backend::resumeApplication() != OK) {
    return DYSECTWARN(Error, "Could not pause application!");
  }

  return OK;
}
开发者ID:SteveXiSong,项目名称:STAT,代码行数:20,代码来源:backend.cpp

示例14: DYSECTVERBOSE

DysectAPI::DysectErrorCode Backend::handleTimerEvents() {
  if(SafeTimer::anySyncReady()) {
    DYSECTVERBOSE(true, "Handle timer notifications");
    vector<Probe*> readyProbes = SafeTimer::getAndClearSyncReady();
    vector<Probe*>::iterator probeIter = readyProbes.begin();

    for(;probeIter != readyProbes.end(); probeIter++) {
      Probe* probe = *probeIter;
      Domain* dom = probe->getDomain();

      DYSECTVERBOSE(true, "Sending enqueued notifications for timed probe: %x", dom->getId());

      probe->sendEnqueuedNotifications();
      pthread_mutex_lock(&probesPendingActionMutex);
      probesPendingAction.push_back(probe);
      pthread_mutex_unlock(&probesPendingActionMutex);
    }
  }

  return OK;
}
开发者ID:SteveXiSong,项目名称:STAT,代码行数:21,代码来源:backend.cpp

示例15: dump_results

void dump_results(google::dense_hash_map<std::string, Probe*> &h_probes)
{
  int cs1[5], cs2[5];
  Probe *op; // Original probe

  google::dense_hash_map<std::string, Probe *>::iterator p_iter;
  for (p_iter=h_probes.begin(); p_iter!=h_probes.end(); p_iter++) {
    // In op we want always the original probe, not the rc one
    op = p_iter->second->is_a_rc_probe ? p_iter->second->rc : p_iter->second;
    if (!op->visited && (op->has_hits() || op->rc->has_hits())) {
      op->get_counters(cs1);
      op->rc->get_counters(cs2);
      std::cout
        << op->get_chrm() << ","
        << op->get_coordinates() <<  ","
        << op->get_id() <<  ","
        << op->get_ref() <<  ","
        << op->get_var() <<  ","

        << cs1[0] << ","
        << cs1[1] << ","
        << cs1[2] << ","
        << cs1[3] << ","
        << cs1[4] << ","

        << cs2[0] << ","
        << cs2[1] << ","
        << cs2[2] << ","
        << cs2[3] << ","
        << cs2[4] << ","

        << cs1[0] + cs2[0] << ","
        << cs1[1] + cs2[1] << ","
        << cs1[2] + cs2[2] << ","
        << cs1[3] + cs2[3] << ","
        << cs1[4] + cs2[4]

        << std::endl;

      op->visited = 1;
      op->rc->visited = 1;
    }
  }
}
开发者ID:drio,项目名称:egrl,代码行数:44,代码来源:count.cpp


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