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

自学教程:C++ ACE_Time_Value类代码示例

51自学网 2021-06-03 12:03:17
  C++
这篇教程C++ ACE_Time_Value类代码示例写得很实用,希望能帮到您。

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

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

示例1:

ScopedTimer::~ScopedTimer() {	destroy_time_ = ACE_OS::gettimeofday();	ACE_Time_Value diff = destroy_time_ - init_time_;	printf("[ScopedTimer: %s Time: %ld.%03ldms]/n",				name_.c_str(),				diff.sec() * 1000 + diff.usec() / 1000,				diff.usec() % 1000);}
开发者ID:jl2005,项目名称:usefull_codes,代码行数:9,


示例2: start

voidtest_i::shutdown (CORBA::Long start_time){  ACE_Time_Value start (0);  start.msec (static_cast<long> (start_time)); // HPUX seems to require this cast  ACE_DEBUG ((LM_DEBUG, "server: Shutting down... (%dms)/n",              (ACE_OS::gettimeofday() - start).msec ()));  this->orb_->shutdown (0);}
开发者ID:asdlei00,项目名称:ACE,代码行数:9,


示例3: conf

bool CoAPRDService::initialize(){    try    {        std::string conf("service.conf");        std::string reactor("service.reactor");        _confPtr = ServiceGetter::findByName<ConfService>(context(), conf);        _reactorPtr = ServiceGetter::findByName<ReactorService>(context(), reactor);    }    catch(toolkit::NullPointerException &e)    {        ACE_DEBUG((LM_DEBUG, "get service failed at SerialPortService/n"));        return false;    }    _coapWrapperPtr = new CoAPWrapper();    if (_coapWrapperPtr->Create(_confPtr->_rdAddr,                                _confPtr->_rdAddrPort,                                _confPtr->_coapDebugLevel                               ) < 0)    {        ACE_DEBUG((LM_DEBUG,"Failed to create coap/n"));        return false;    }    _rdRes = new CoAP_RD_Resource(_coapWrapperPtr.get());    if ((_rdRes->Create()) == 0)    {        ACE_DEBUG((LM_DEBUG,"Failed to craete rd resource/n"));        return false;    }    _rdLookup = new CoAPRDLookUpResource(_coapWrapperPtr.get());    if ((_rdLookup->Create()) == 0)    {        ACE_DEBUG((LM_DEBUG,"Failed to craete lookup resource/n"));        return false;    }    ACE_Time_Value timeout;    timeout.sec(5);    _reactorPtr->register_handler(this, ACE_Event_Handler::READ_MASK);    _reactorPtr->schedule_timer(this, 0, timeout);    return true;}
开发者ID:hisilicon,项目名称:IoTGateway,代码行数:56,


示例4: delaySystem

/// WARNING: actual precision under WIN32 depends on setting scheduler/// by means of MM functions.///void SystemClock::delaySystem(double seconds) {#ifdef YARP_HAS_ACE    ACE_Time_Value tv;    tv.sec (long(seconds));    tv.usec (long((seconds-long(seconds)) * 1.0e6));    ACE_OS::sleep(tv);#else    usleep(seconds*1000000);#endif}
开发者ID:BRKMYR,项目名称:yarp,代码行数:13,


示例5:

intSTDIN_Handler::handle_timeout (const ACE_Time_Value &tv,                               const void *){  ACE_DEBUG ((LM_DEBUG,              "(%t) timeout occurred at %d sec, %d usec/n",              tv.sec (),              tv.usec ()));  return 0;}
开发者ID:BackupTheBerlios,项目名称:pyasynchio-svn,代码行数:10,


示例6: ACE_NEW_THROW_EX

    CORBA::Object_ptr    ServantRetentionStrategyNonRetain::create_reference (      const char *intf,      CORBA::Short priority)    {      // This operation creates an object reference that encapsulates a      // POA-generated Object Id value and the specified interface      // repository id. This operation does not cause an activation to      // take place. The resulting reference may be passed to clients, so      // that subsequent requests on those references will cause the      // appropriate servant manager to be invoked, if one is      // available. The generated Object Id value may be obtained by      // invoking POA::reference_to_id with the created reference.      PortableServer::ObjectId_var system_id;      PortableServer::ObjectId user_id;      // Otherwise, it is the NON_RETAIN policy.  Therefore, any ol'      // object id will do (even an empty one). However, to make an      // object id useful for discriminating objects in applications      // use a simple id of a counter and a time stamp. The use of a      // counter by itself is not sufficient for uniqueness over time      // and a timestamp isn't sufficient since multiple IDs may be      // requested within the same time unit.      PortableServer::ObjectId *sys_id = 0;      ACE_NEW_THROW_EX (sys_id,                        PortableServer::ObjectId (8),                        CORBA::NO_MEMORY ());      sys_id->length(8);      long count = this->sys_id_count_++;      ACE_Time_Value now = ACE_OS::gettimeofday();      ACE_UINT32 *id_ptr = reinterpret_cast<ACE_UINT32 *>(sys_id->get_buffer());      *(id_ptr++) = count;      *id_ptr = static_cast<ACE_UINT32>(now.sec());      system_id = sys_id;      // User id is the same as system id.      user_id = system_id.in ();      // Remember params for potentially invoking <key_to_object> later.      this->poa_->key_to_object_params_.set (system_id,                                             intf,                                             0,                                             1,                                             priority,                                             true);      return this->poa_->invoke_key_to_object_helper_i (intf, user_id);    }
开发者ID:CCJY,项目名称:ATCD,代码行数:55,


示例7: handleSynchSetup

static int handleSynchSetup(CRtspSession* pSession, const unsigned int unTimeout,                            const bool bTcpFlag, MEDIA_ADDR *pstPeerMediaAddr){    // 等待信号触发,否则阻塞在此    ACE_Time_Value wait = ACE_OS::gettimeofday();    wait.sec (wait.sec () + unTimeout);    int nRet = pSession->m_pRtspSemaphore->acquire(&wait);    // 接收超时,直接返回    if(0 != nRet)    {        ACE_Guard <ACE_Thread_Mutex> locker (pSession->m_Mutex);        IVS_RUN_LOG_ERR("receive rtsp setup response out of time, handle[%p].", pSession);        pSession->destroyRtspMsg();        return RTSP_ERR_TIMEOUT;    }	//IVS_RUN_LOG_ERR("----- handleSynchSetup 1, handle[%p].", pSession);    // 解析错误,直接返回    if (!pSession->m_bRecvRetFlag)    {		ACE_Guard <ACE_Thread_Mutex> locker (pSession->m_Mutex);		int iRet = pSession->m_iRetCode;        pSession->destroyRtspMsg();		IVS_RUN_LOG_ERR("receive rtsp setup response decode error, handle[%p], RetCode[%d].", pSession, iRet);        return iRet;    }	//IVS_RUN_LOG_ERR("----- handleSynchSetup 2, handle[%p].", pSession);    // UDP传输方式下,获取媒体流发送地址    //if (false == bTcpFlag)    CRtspSetupMessage* pRtspMsg = dynamic_cast<CRtspSetupMessage*>(pSession->m_pRtspMsg);    if (NULL == pRtspMsg)    {		IVS_RUN_LOG_ERR("receive rtsp setup response msg is null, handle[%p].", pSession);        return RET_FAIL;    }    if (0 != pRtspMsg->getServerIp())    {        pstPeerMediaAddr->unMediaIp        = pRtspMsg->getServerIp();           //lint !e613        pstPeerMediaAddr->unMediaVideoPort = pRtspMsg->getServerVideoPort();    //lint !e613        pstPeerMediaAddr->unMediaAudioPort = pRtspMsg->getServerAudioPort();    //lint !e613    } 	//IVS_RUN_LOG_ERR("----- handleSynchSetup 3, handle[%p].", pSession);    // 释放消息    pSession->destroyRtspMsg();    // 解析成功,更改状态为ready    pSession->setStatus(RTSP_SESSION_STATUS_READY);    IVS_RUN_LOG_INF("send setup message success, handle[%p].", pSession);    return RET_OK;}
开发者ID:rgmabs19357,项目名称:esdk_ivs_sdk_windows,代码行数:55,


示例8: handle_timeout

int RDService::handle_timeout (const ACE_Time_Value &tv,                            const void *arg){    ACE_Time_Value timeout;    timeout.sec(5);        coap_wrapper_->time_out(timeout);    net_->schedule_timer(this, 0, timeout);        return 0;}
开发者ID:herryfan,项目名称:IoTGateway,代码行数:11,


示例9:

ACE_Log_Record::ACE_Log_Record (ACE_Log_Priority lp,                                const ACE_Time_Value &ts,                                long p)  : length_ (0),    type_ (ACE_UINT32 (lp)),    secs_ ((ACE_UINT32) ts.sec ()),    usecs_ ((ACE_UINT32) ts.usec ()),    pid_ (ACE_UINT32 (p)){  // ACE_TRACE ("ACE_Log_Record::ACE_Log_Record");}
开发者ID:dariuskylin,项目名称:utilityLib,代码行数:11,


示例10: policy_list

boolClient::flood_connection (ACE_Time_Value& tv){  // Block flushing currently blocks even on SYNC_DELAYED_BUFFERING  //  so we can't use it to flood connections.  // Set the policy value.  // SYNC_DELAYED_BUFFERING is used to ensure that the tcp buffer gets filled before  //  buffering starts.  Messaging::SyncScope sync_scope = TAO::SYNC_DELAYED_BUFFERING;  //Messaging::SyncScope sync_scope = Messaging::SYNC_NONE;  CORBA::Any sync_scope_any;  sync_scope_any <<= sync_scope;  CORBA::PolicyList policy_list (1);  policy_list.length (1);  policy_list[0] = orb_->create_policy    (Messaging::SYNC_SCOPE_POLICY_TYPE, sync_scope_any);  // Apply the policy at the object level  CORBA::Object_var obj = test_obj_->_set_policy_overrides    (policy_list, CORBA::SET_OVERRIDE);  Test_var mod_test_obj = Test::_narrow (obj.in ());  policy_list[0]->destroy ();  policy_list.length(0);  ACE_Auto_Array_Ptr<char> tmp (new char [2000000]);  char* msg = tmp.get();  ACE_OS::memset (msg,'A',1999999);  msg[1999999] = 0;  test_obj_->sleep (static_cast<CORBA::Long>(tv.sec())                    , static_cast<CORBA::Long>(tv.msec()));  /* BLOCK flush startegy always has SYNC_WITH_TRANSPORT semantics.      Trying to flood a BLOCKed flushing connection can lead to a TIMEOUT      exception being thrown. This will close out the connection and      the whole flooding attempt fails. Therefore in BLOCK flushing case      don't attempt to flood (unless BLOCK flush accepts SYNC_WITH_TRANSPORT      semantics).   */  if (flush_strategy_ != BLOCKING)    {      mod_test_obj->dummy_one_way (msg);      // attempt again to flood connection.      ACE_Time_Value tv_tmp (2);      orb_->perform_work (tv_tmp);    }  return true;}
开发者ID:OspreyHub,项目名称:ATCD,代码行数:53,


示例11: run_main

intrun_main (int, ACE_TCHAR *[]){  ACE_START_TEST (ACE_TEXT ("Reactor_Notify_Test"));  int test_result = 0;       // Innocent until proven guilty  if (0 == run_notify_purge_test ())    {      ACE_DEBUG ((LM_DEBUG,                  ACE_TEXT ("purge_pending_notifications test OK/n")));    }  else    {      ACE_ERROR ((LM_ERROR,                  ACE_TEXT ("purge_pending_notifications test FAIL/n")));      test_result = 1;    }#if defined (ACE_HAS_THREADS)  if (0 != run_quiet_notify_test ())    test_result = 1;  ACE_Time_Value timeout (SHORT_TIMEOUT);  ACE_DEBUG ((LM_DEBUG,              ACE_TEXT ("(%t) running tests with notify pipe enabled")              ACE_TEXT (" and time-out = %d seconds/n"),              timeout.sec ()));  run_test (0, timeout);  ACE_DEBUG ((LM_DEBUG,              ACE_TEXT ("(%t) running tests with notify pipe disabled")              ACE_TEXT (" and time-out = %d seconds/n"),              timeout.sec ()));  run_test (1, timeout);  timeout.set (LONG_TIMEOUT, 0);  ACE_DEBUG ((LM_DEBUG,              ACE_TEXT ("(%t) running tests with reactor notification ")              ACE_TEXT ("pipe enabled/n")              ACE_TEXT (" and time-out = %d seconds/n"),              timeout.sec ()));  run_test (0, timeout);#else  ACE_ERROR ((LM_INFO,              ACE_TEXT ("threads not supported on this platform/n")));#endif /* ACE_HAS_THREADS */  ACE_END_TEST;  return test_result;}
开发者ID:asdlei00,项目名称:ACE,代码行数:52,


示例12: handle_timeout

int CoAPRDService::handle_timeout (const ACE_Time_Value &tv,                                   const void *arg){    ACE_Time_Value timeout;    timeout.sec(5);    _coapWrapperPtr->time_out(timeout);    _reactorPtr->schedule_timer(this, 0, timeout);    _rdRes->timeout();    return 0;}
开发者ID:hisilicon,项目名称:IoTGateway,代码行数:13,


示例13: Init

int RDService::Init(){    ACE_Time_Value timeout;    timeout.sec(5);        if ((coap_wrapper_ = new CoAPWrapper()) == 0)    {        ACE_DEBUG((LM_DEBUG, "Failed to allocate CoAPWrapper in RD/n"));        return -1;    }    if (coap_wrapper_->Create(conf_->rd_addr_,                               conf_->rd_addr_port_,                              conf_->coap_debug_level_                              ) < 0)    {        ACE_DEBUG((LM_DEBUG,"Failed to create coap/n"));        return -1;    }    if ((rd_resource_ = new CoAP_RD_Resource(coap_wrapper_)) == 0)    {        ACE_DEBUG((LM_DEBUG, "Failed to allocate rd resource in RD/n"));        return -1;    }    if ((rd_resource_->Create()) == 0)    {        ACE_DEBUG((LM_DEBUG,"Failed to craete rd resource/n"));        return -1;    }        if ((lookup_resource_ = new CoAPRDLookUpResource(coap_wrapper_)) == 0)    {        ACE_DEBUG((LM_DEBUG, "Failed to allocate lookup resource in RD/n"));        return -1;    }    if ((lookup_resource_->Create()) == 0)    {        ACE_DEBUG((LM_DEBUG,"Failed to craete lookup resource/n"));        return -1;    }    net_->join(coap_wrapper_->get_handle());    net_->RegHandler(this, ACE_Event_Handler::READ_MASK);    net_->schedule_timer(this, 0, timeout);        return 0;}
开发者ID:herryfan,项目名称:IoTGateway,代码行数:51,


示例14: test_timeout

// Tests the amount of time spent in a timed wait.static inttest_timeout (void){  int status = 0;  // milliseconds...  long msecs_expected;  long msecs_waited;  long msecs_diff;  // Wait a little longer each time  static long wait_secs = 3;  ACE_Time_Value wait = ACE_OS::gettimeofday ();  ACE_Time_Value begin = wait;  wait.sec (wait.sec () + wait_secs);  if (s.acquire (wait) == -1)    {      if (errno != ETIME)        {          ACE_ERROR ((LM_ERROR,                      ACE_TEXT ("%p/n"),                      ACE_TEXT ("test_timeout should be ETIME but is")));          status = -1;        }    }  ACE_Time_Value wait_diff = ACE_OS::gettimeofday () - begin;  msecs_waited = wait_diff.msec ();  msecs_expected = wait_secs * 1000;  msecs_diff = labs (msecs_expected - msecs_waited);  if (msecs_diff > ACE_ALLOWED_SLACK)    {      ACE_ERROR ((LM_ERROR,                  ACE_TEXT ("Timed wait fails length test/n")));      ACE_ERROR ((LM_ERROR,                  ACE_TEXT ("Expected %d ms, actual %d ms; %d allowed/n"),                  (int)msecs_expected,                  (int)msecs_waited,                  (int)ACE_ALLOWED_SLACK));      status = -1;    }  ++wait_secs;  return status;}
开发者ID:esohns,项目名称:ATCD,代码行数:52,


示例15: ACE_DEBUG

intThr_Consumer_Handler::svc (void){  for (in_thread_ = 1;;)    {      ACE_DEBUG ((LM_DEBUG,                  "(%t) Thr_Consumer_Handler's handle = %d/n",                  this->peer ().get_handle ()));      // Since this method runs in its own thread it is OK to block on      // output.      for (ACE_Message_Block *mb = 0;           this->msg_queue ()->dequeue_head (mb) != -1;           )        if (this->send (mb) == -1)          ACE_ERROR ((LM_ERROR,                      "(%t) %p/n",                      "send failed"));      ACE_ASSERT (errno == ESHUTDOWN);      ACE_DEBUG ((LM_DEBUG,                  "(%t) shutting down threaded Consumer_Handler %d on handle %d/n",                  this->connection_id (),                  this->get_handle ()));      this->peer ().close ();      // Re-establish the connection, using exponential backoff.      for (this->timeout (1);           // Default is to reconnect synchronously.           this->event_channel_->initiate_connection_connection (this, 1) == -1;           // Second parameter '1' means using sync mode directly,           // don't care Options::blocking_semantics().  If don't do           // so, async mode will be used to connect which won't           // satisfy original design.           )        {          ACE_Time_Value tv (this->timeout ());          ACE_ERROR ((LM_ERROR,                      "(%t) reattempting connection, sec = %d/n",                      tv.sec ()));          ACE_OS::sleep (tv);        }    }  ACE_NOTREACHED (return 0;)}
开发者ID:BackupTheBerlios,项目名称:pyasynchio-svn,代码行数:51,


示例16:

CORBA::BooleanTAO_Log_i::scheduled (void){  DsLogAdmin::TimeInterval interval =    this->recordstore_->get_interval ();  TimeBase::TimeT current_time;  ACE_Time_Value tv = ACE_OS::gettimeofday ();  ORBSVCS_Time::Time_Value_to_TimeT (current_time, tv);  if (current_time >= interval.start      && (current_time <= interval.stop || interval.stop == 0))    {      if (weekly_intervals_.length () > 0)        {          // Work out when sunday is in nanoseconds.          time_t clock = tv.sec ();          struct tm *sunday = ACE_OS::localtime (&clock);          sunday->tm_sec = 0;          sunday->tm_min = 0;          sunday->tm_hour = 0;          sunday->tm_mday -= sunday->tm_wday;          tv.sec (ACE_OS::mktime (sunday));          tv.usec (0);          TimeBase::TimeT nano_sunday =            (CORBA::ULongLong) tv.sec () * 10000000;          for (CORBA::ULong i = 0; i < weekly_intervals_.length (); ++i)            {              if (current_time >= (weekly_intervals_[i].start + nano_sunday)                  && current_time <= (weekly_intervals_[i].stop + nano_sunday))                {                  return true;                }            }          return false;        }      else        {          return true;        }    }  else    {      return false;    }}
开发者ID:asdlei00,项目名称:ACE,代码行数:51,


示例17: ACE_ASSERT

/// @todo: rather than is_error, use pacing interval so it will be configurable/// @todo: find some way to use batch buffering stratgy for sequence consumers.voidTAO_Notify_Consumer::schedule_timer (bool is_error){  if (this->timer_id_ != -1)    {      return; // We only want a single timeout scheduled.    }  // don't schedule timer if there's nothing that can be done  if (this->is_suspended ())    {      return;    }  ACE_ASSERT (this->timer_.get() != 0);  // If we're scheduling the timer due to an error then we want to  // use the retry timeout, otherwise we'll assume that the pacing  // interval is sufficient for now.  ACE_Time_Value tv (DEFAULT_RETRY_TIMEOUT);  if (! is_error)    {      if (this->pacing_.is_valid ())        {          tv = ORBSVCS_Time::to_Time_Value (this->pacing_.value ());        }    }  if (DEBUG_LEVEL  > 5)    {      ORBSVCS_DEBUG ((LM_DEBUG,                  ACE_TEXT ("Consumer %d: scheduling pacing/retry for %dms./n"),                  static_cast<int> (this->proxy ()->id ()), tv.msec ()));    }  this->timer_id_ =    this->timer_->schedule_timer (this, tv, ACE_Time_Value::zero);  if (this->timer_id_ == -1)    {      ORBSVCS_ERROR ((LM_ERROR,                  ACE_TEXT ("TAO_Notify_Consumer %d::schedule_timer () ")                  ACE_TEXT ("Error scheduling timer./n"),                  static_cast<int> (this->proxy ()->id ())                  ));    }  if (this->is_suspended()) // double check to avoid race  {    this->cancel_timer();  }}
开发者ID:CCJY,项目名称:ATCD,代码行数:52,


示例18: usleep

void yarp::os::impl::sleepThread(ACE_Time_Value& sleep_period){#ifdef YARP_HAS_ACE    if (sleep_period.usec() < 0 || sleep_period.sec() < 0)        sleep_period.set(0,0);    ACE_OS::sleep(sleep_period);#else    if (sleep_period.tv_usec < 0 || sleep_period.tv_sec < 0) {        sleep_period.tv_usec = 0;        sleep_period.tv_sec = 0;    }    usleep(sleep_period.tv_sec * 1000000 + sleep_period.tv_usec );#endif}
开发者ID:johnty,项目名称:libYARP_OS,代码行数:14,


示例19: ACE_MT

void MgServerFeatureTransactionPool::RemoveExpiredTransaction(){    ACE_MT(ACE_GUARD(ACE_Recursive_Thread_Mutex, ace_mon, sm_mutex));    MG_CONFIGURATION_TRY()    ACE_Time_Value now = ACE_OS::gettimeofday();    FeatureTransactionCollection::iterator iterator = m_featureTransactions.begin();    while (iterator != m_featureTransactions.end())    {        MgServerFeatureTransaction* featTransaction = iterator->second;        if (NULL != featTransaction)        {            INT64 time = now.sec() - featTransaction->LastUsed().sec();            if (time > m_transactionTimeout)            {                try                {                    // Set timeout for this transaction object. It will release the internal FdoITransaction object.                    featTransaction->SetTimeout();                }                catch (FdoException* e)                {                    FDO_SAFE_RELEASE(e);                }                catch (...)                {                }                featTransaction->Release();                // Add the id to timeout list                m_transactionTimeoutIds.push_back(iterator->first);                m_featureTransactions.erase(iterator++);            }            else            {                ++iterator;            }        }        else        {            assert(false);            ++iterator;        }    }    MG_CONFIGURATION_CATCH_AND_THROW(L"MgServerFeatureTransactionPool.RemoveExpiredTransaction")}
开发者ID:kanbang,项目名称:Colt,代码行数:50,


示例20:

  bool  Eager_Transport_Queueing_Strategy::timer_check (    const TAO::BufferingConstraint &buffering_constraint,    const ACE_Time_Value &current_deadline,    bool &set_timer,    ACE_Time_Value &new_deadline) const  {    set_timer = false;    if (!ACE_BIT_ENABLED (buffering_constraint.mode,                          TAO::BUFFER_TIMEOUT))      {        return false;      }    // Compute the next deadline...    ACE_Time_Value const now = ACE_OS::gettimeofday ();    ACE_Time_Value timeout =      this->time_conversion (buffering_constraint.timeout);    new_deadline = now + timeout;    // Check if the new deadline is more stringent, or if the deadline    // has expired and thus must be reset anyway.    if (current_deadline > new_deadline        || current_deadline < now)      {        set_timer = true;      }    // ... if there is no deadline we don't want to schedule output (the    // deadline will be set because set_timer is set to 1 in that case).    // If there is a deadline but but it has not been reached, we    // don't want to schedule any output either...    if (current_deadline == ACE_Time_Value::zero        || current_deadline >= now)      {        return false;      }    if (TAO_debug_level > 6)      {        TAOLIB_DEBUG ((LM_DEBUG,                    "TAO (%P|%t) - TAO_Eager_Buffering_Sync_Strategy::timer_check, "                    "Now = %u, Current = %u, New = %u/n",                    now.msec (), current_deadline.msec (),                    new_deadline.msec ()));      }    return true;  }
开发者ID:asdlei00,项目名称:ACE,代码行数:50,


示例21: worker

static void *worker (void *){  for (int iterations = 1;       iterations <= n_iterations;       iterations++)    {      //FUZZ: disable check_for_lack_ACE_OS      ACE_Time_Value wait (0,                           iterations * 1000 * 100);  // Wait 'iter' msec      //FUZZ: enable check_for_lack_ACE_OS      ACE_Time_Value tv = ACE_OS::gettimeofday () + wait;      if (evt.wait (&tv) == -1)      {          // verify that we have ETIME          if (ACE_OS::last_error() != ETIME)            {              ACE_ERROR ((LM_ERROR,                          ACE_TEXT ("%p/n"),                          ACE_TEXT ("Worker should be ETIME but is")));            }          else            ++timeouts;          ACE_Time_Value diff = ACE_OS::gettimeofday ();          diff = diff - tv;       // tv should have been reset to time acquired          long diff_msec = diff.msec ();          if (diff_msec > ACE_ALLOWED_SLACK)            {              ACE_ERROR ((LM_ERROR,                          ACE_TEXT ("Acquire fails time reset test/n")));              ACE_ERROR ((LM_ERROR,                          ACE_TEXT ("Diff btw now and returned time: %d ms; ")                          ACE_TEXT ("%d allowed/n"),                          (int)diff_msec,                          (int)ACE_ALLOWED_SLACK));              test_result = 1;            }          // Hold the lock for a while.          ACE_OS::sleep (ACE_Time_Value (0,                                         (ACE_OS::rand () % 1000) * 1000));          evt.signal ();      }      ACE_Thread::yield ();    }  return 0;}
开发者ID:chrrrisw,项目名称:ACE,代码行数:50,


示例22: log

  // TODO improve via loglevel  void log(int logLevel, std::string s) {     //   cerr << __FILE__  << " : "     // 	 << __LINE__ << ":"     // 	 << __FUNCTION__<< s << endl;    ACE_Time_Value time;    time_t tt;    time = ACE_OS::gettimeofday();    tt = time.sec();     std::string label[]={"[INFO]","[WARNING]","[ERROR]","[FATAL ERROR]"};    cerr  << "[main] " << label[logLevel] << " " << s << " " << ctime(&tt);    }
开发者ID:BackupTheBerlios,项目名称:miro-middleware-svn,代码行数:15,


示例23: return

CORBA::ULongLongTAO_Time_Service_Clerk::get_time (void){  // Globally sync. time is the latest global time plus the time  // elapsed since last updation was done.  const ACE_Time_Value timeofday = ACE_OS::gettimeofday ();  return (CORBA::ULongLong) (static_cast<CORBA::ULongLong> (timeofday.sec ()) *                             static_cast<ACE_UINT32> (10000000) +                             static_cast<CORBA::ULongLong> (timeofday.usec () * 10))    - this->update_timestamp_    + this->time_;}
开发者ID:binary42,项目名称:OCI,代码行数:14,


示例24: main

int main(){    ACE::init();    fprintf(stderr, "Starting timing test/n");    ACE_Time_Value now1,now2;    ACE_High_Res_Timer timer;    ACE_Profile_Timer profiler;    ACE_Time_Value sleep;    ACE_Time_Value elapsed;    double avErrors[wTimes];        int i,k;    for(i=0;i<wTimes;i++)        avErrors[i]=0;    for(i=0;i<iterations;i++)        {            double req;            double time;            for(k=0;k<wTimes;k++)                {                    req=sleepT[k];                    sleep.msec(sleepT[k]);                                        now1 = ACE_OS::gettimeofday ();                                        //ACE_OS::sleep(sleep);                    usleep(sleep.sec()*1000000+sleep.usec()-1000);                    now2 = ACE_OS::gettimeofday ();                    time=(now2.sec()-now1.sec())*1000;                    time+=(now2.usec()-now1.usec())/1000;                    avErrors[k]+=fabs(req-time)/iterations;                    fprintf(stderr, "*");                }            fprintf(stderr, "Completed %d out of %d/n", i+1, iterations);        }    for(i=0;i<wTimes;i++)        {            sleep.msec(sleepT[i]);            fprintf(stderr, "Req %us and %u[ms], average error %.3lf/n", (unsigned int)sleep.sec(), (unsigned int) sleep.usec()/1000, avErrors[i]);        }    ACE::fini();}
开发者ID:AbuMussabRaja,项目名称:yarp,代码行数:50,


示例25: at

intThread_Handler::handle_timeout (const ACE_Time_Value &time, const void *){  ACE_DEBUG ((LM_DEBUG,              "(%t) received timeout at (%u, %u), iterations = %d/n",              time.sec (),              time.usec (),              this->iterations_));  if (--this->iterations_ <= 0      || Thread_Handler::interval_.sec () == 0)    ACE_Reactor::end_event_loop ();  return 0;}
开发者ID:asdlei00,项目名称:ACE,代码行数:15,


示例26: sysDescr

// this routine makes up the brains of the agent// it knows only the MIB II system group set of variables for a get operationint agent_impl::get_response(Vb& vb){  // these objects represent the MIB II system group per RFC 1213   static Oid sysDescr("1.3.6.1.2.1.1.1.0"),   sysObjectID("1.3.6.1.2.1.1.2.0"), sysUpTime("1.3.6.1.2.1.1.3.0"),   sysContact("1.3.6.1.2.1.1.4.0"), sysName("1.3.6.1.2.1.1.5.0"),   sysLocation("1.3.6.1.2.1.1.6.0"), sysServices("1.3.6.1.2.1.1.7.0");  Oid oid;  vb.get_oid(oid);  if (oid == sysDescr) {    OctetStr desc("ASNMP Prototype Agent 1.0");    vb.set_value(desc);  }  else if (oid == sysObjectID) { // the IANA gives assigns Enterprise Numbers    // see ftp://ftp.isi.edu/in-notes/iana/assignments/enterprise-numbers    // for the official list of enterprise numbers. Then under this tree    // assign a unique subtree to identify this agent    Oid id("1.3.6.1.4.1.2533.9.1");    vb.set_value(id);  }  else if (oid == sysUpTime) {    ACE_Time_Value tv;    agent_clock_.elapsed_time (tv);    TimeTicks tt(tv.msec());    vb.set_value(tt);  }  else if (oid == sysContact) {    OctetStr contact("[email
C++ ACE_Token_Proxy类代码示例
C++ ACE_TString类代码示例
万事OK自学网:51自学网_软件自学网_CAD自学网自学excel、自学PS、自学CAD、自学C语言、自学css3实例,是一个通过网络自主学习工作技能的自学平台,网友喜欢的软件自学网站。