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

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

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

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

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

示例1: seqstrseq_time_test

void seqstrseq_time_test (CORBA::ULong num_seq_loops,                          CORBA::ULong num_string_loops,                          bool use_long_str){  ACE_High_Res_Timer timer;  ACE_hrtime_t time;  CORBA::ULong sss_len;  CORBA::ULong str_len;  Sequence_Str_Sequences seqs;  seqs.seq_str_seq.length(0);  // start timing  timer.start();  for (CORBA::ULong seq_idx = 0; seq_idx < num_seq_loops; ++seq_idx)  {    sss_len = seqs.seq_str_seq.length();    seqs.seq_str_seq.length(sss_len + 1);    Str_Sequences & strs = seqs.seq_str_seq[sss_len];    //strs.first_str.length(0);    for (CORBA::ULong str_idx = 0; str_idx < num_string_loops; ++str_idx)    {      str_len = strs.second_str.length();      strs.second_str.length(str_len + 1);      strs.second_str[str_len] = use_long_str ? long_str : short_str;    }  }  // end timing  timer.stop();  timer.elapsed_time(time);  if (use_csv)    {      ACE_DEBUG((LM_INFO,                 ACE_TEXT("2, 0, %u, %u, %s, %Q/n"),                 num_string_loops,                 num_seq_loops,                 use_long_str ? ACE_TEXT("long"): ACE_TEXT("short"),                 time ));    }  else    {      ACE_DEBUG((LM_INFO,                 ACE_TEXT("Sequence of string seq (%u, %u, %s) = %Q ns/n"),                 num_string_loops,                 num_seq_loops,                 use_long_str ? ACE_TEXT("long"): ACE_TEXT("short"),                 time ));    }}
开发者ID:OspreyHub,项目名称:ATCD,代码行数:52,


示例2: speed_test

static intspeed_test (ACE_UINT32 loops){  double tt    = 0.0,    ut    = 0.0,    utus  = 0.0,    speed = 0.0;  ACE_Time_Value tc;  void *ptr = 0;  ACE_UINT32 i = loops;  size_t n_chunks = 10;  size_t chunk_size = 8;  ACE_DEBUG ((LM_INFO,              ACE_TEXT (" (%t) ACE_Dynamic_Cached_Allocator ")              ACE_TEXT ("speed test.../n")));  DYNAMIC_ALLOCATOR allocator (n_chunks, chunk_size);  ACE_High_Res_Timer timer;  timer.reset ();  timer.start ();  while (i--)    {      ptr = allocator.malloc (chunk_size);      allocator.free (ptr);    }  timer.stop ();  timer.elapsed_time (tc);  ACE_DEBUG ((LM_INFO, ACE_TEXT (" (%t) Iterations : %d/n"), loops));  tt    = tc.sec () + tc.usec ()*1.0e-6;  ut    = tt/loops;  utus  = ut*1.0e6;  speed = loops/tt;  ACE_DEBUG ((LM_INFO, ACE_TEXT (" (%t) Total time : %.6g [s]/n"), tt));  ACE_DEBUG ((LM_INFO, ACE_TEXT (" (%t) Unit time  : %.6g [us]/n"), utus));  ACE_DEBUG ((LM_INFO, ACE_TEXT (" (%t) Speed      : %.6g [1/s]/n"), speed));  return 0;}
开发者ID:helixum,项目名称:wow-cata,代码行数:47,


示例3: ACE_DEBUG

int MyTask::svc (void){  ACE_hthread_t thr_handle;  ACE_Thread::self (thr_handle);  ACE_DEBUG ((LM_DEBUG, "(%t|%T): task activated/n"));  ACE_ASSERT (dispatcher_ != 0);  (void) dispatcher_->schedule (guid_, qos_);  barrier_.wait ();  long prime_number = 9619899;  ACE_High_Res_Timer timer;  ACE_Time_Value elapsed_time;  ACE_Time_Value seconds_tracker(0,0);  ACE_Time_Value one_second (1,0);  ACE_Time_Value compute_count_down_time (exec_duration_, 0);  ACE_Countdown_Time compute_count_down (&compute_count_down_time);  timer.start ();  while (compute_count_down_time > ACE_Time_Value::zero)    {      ACE::is_prime (prime_number,                     2,                     prime_number / 2);      compute_count_down.update ();      timer.stop ();      timer.elapsed_time (elapsed_time);      seconds_tracker += elapsed_time;      if (seconds_tracker >= one_second)      {        seconds_tracker.set (0,0);        ACE_DEBUG ((LM_DEBUG,                    ACE_TEXT ("(%t) Currently running guid=%d")                    ACE_TEXT (", qos_.importance=%d/n"),                    guid_, qos_.importance_));      }      timer.reset ();      timer.start ();    }  dispatcher_->cancel_schedule (this->guid_);  return 0;}
开发者ID:esohns,项目名称:ATCD,代码行数:48,


示例4: time_interval

staticACE_Time_Valuetime_interval (const ACE_Time_Value &interval,               ACE_hrtime_t& nanoseconds,               ACE_hrtime_t& microseconds){  ACE_High_Res_Timer timer;  timer.start ();  ACE_OS::sleep (interval);  timer.stop ();  ACE_Time_Value measured;  timer.elapsed_time (measured);  timer.elapsed_time (nanoseconds);  timer.elapsed_microseconds (microseconds);  return measured;}
开发者ID:DOCGroup,项目名称:ACE_TAO,代码行数:18,


示例5: ACE_TMAIN

//.........这里部分代码省略.........      configuration.map_size_y = 0;  } // end IF  // step1bb: validate arguments  if ((!random &&       ((configuration.num_areas == 0)  ||        (configuration.map_size_x == 0) ||        (configuration.map_size_y == 0)))         ||      (configuration.max_num_doors_per_room == 1) || // cannot enforce this (yet: *TODO*)      (configuration.corridors &&       !configuration.doors))                        // cannot have corridors without doors...  {    ACE_DEBUG((LM_DEBUG,               ACE_TEXT("invalid argument(s), aborting/n")));    // make 'em learn...    do_printUsage(std::string(ACE::basename(argv_in[0])));    // *PORTABILITY*: on Windows, need to fini ACE...#if defined (ACE_WIN32) || defined (ACE_WIN64)    if (ACE::fini () == -1)      ACE_DEBUG ((LM_ERROR,                  ACE_TEXT ("failed to ACE::fini(): /"%m/", continuing/n")));#endif    return EXIT_FAILURE;  } // end IF  // step1c: initialize logging and/or tracing  std::string log_file;  if (!Common_Tools::initializeLogging (ACE::basename (argv_in[0]),   // program name                                        log_file,                    // logfile                                        false,                       // log to syslog ?                                        false,                       // trace messages ?                                        trace_information,           // debug messages ?                                        NULL))                       // logger  {    ACE_DEBUG ((LM_ERROR,                ACE_TEXT ("failed to Common_Tools::initializeLogging(), aborting/n")));    // *PORTABILITY*: on Windows, need to fini ACE...#if defined (ACE_WIN32) || defined (ACE_WIN64)    if (ACE::fini () == -1)      ACE_DEBUG ((LM_ERROR,                  ACE_TEXT ("failed to ACE::fini(): /"%m/", continuing/n")));#endif    return EXIT_FAILURE;  } // end IF  // step1d: handle specific program modes  if (print_version_and_exit)  {    do_printVersion(std::string(ACE::basename(argv_in[0])));    // *PORTABILITY*: on Windows, need to fini ACE...#if defined (ACE_WIN32) || defined (ACE_WIN64)    if (ACE::fini () == -1)      ACE_DEBUG ((LM_ERROR,                  ACE_TEXT ("failed to ACE::fini(): /"%m/", continuing/n")));#endif    return EXIT_SUCCESS;  } // end IF  ACE_High_Res_Timer timer;  timer.start();  // step2: do actual work  do_work(configuration,          generate_level,          output_file,          dump_result,          random);  timer.stop();  // debug info  std::string working_time_string;  ACE_Time_Value working_time;  timer.elapsed_time(working_time);  RPG_Common_Tools::period2String(working_time,                                  working_time_string);  ACE_DEBUG((LM_DEBUG,             ACE_TEXT("total working time (h:m:s.us): /"%s/".../n"),             ACE_TEXT(working_time_string.c_str())));  // *PORTABILITY*: on Windows, fini ACE...#if defined (ACE_WIN32) || defined (ACE_WIN64)  if (ACE::fini () == -1)  {    ACE_DEBUG ((LM_ERROR,                ACE_TEXT ("failed to ACE::fini(): /"%m/", aborting/n")));    return EXIT_FAILURE;  } // end IF#endif  return EXIT_SUCCESS;} // end main
开发者ID:bhutnath,项目名称:yarp,代码行数:101,


示例6: main

int main(int argc, char** argv){    char map_magic[16];    int thisBuild = getBuildNumber();    int iCoreNumber = getCoreNumberFromBuild(thisBuild);    showBanner("Movement Map Generator", iCoreNumber);    setMapMagicVersion(iCoreNumber, map_magic);    showWebsiteBanner();    int mapnum = -1;    float maxAngle = 60.0f;    int tileX = -1, tileY = -1;    bool skipLiquid = false,         skipContinents = false,         skipJunkMaps = true,         skipBattlegrounds = false,         debugOutput = false,         silent = false,         bigBaseUnit = false;    int num_threads = 0;    char* offMeshInputPath = NULL;    bool validParam = handleArgs(argc, argv, mapnum,                                 tileX, tileY, maxAngle,                                 skipLiquid, skipContinents, skipJunkMaps, skipBattlegrounds,                                 debugOutput, silent, bigBaseUnit, num_threads, offMeshInputPath);    if (!validParam)        { return silent ? -1 : finish(" You have specified invalid parameters (use -h for more help)", -1); }    if (mapnum == -1 && debugOutput)    {        if (silent)            { return -2; }        printf(" You have specifed debug output, but didn't specify a map to generate./n");        printf(" This will generate debug output for ALL maps./n");        printf(" Are you sure you want to continue? (y/n) ");        if (getchar() != 'y')            { return 0; }    }    if (!checkDirectories(debugOutput))        { return silent ? -3 : finish(" Press any key to close...", -3); }    MapBuilder builder(map_magic, maxAngle, skipLiquid, skipContinents, skipJunkMaps,                       skipBattlegrounds, debugOutput, bigBaseUnit, offMeshInputPath);    ACE_Time_Value elapsed;    ACE_High_Res_Timer timer;        timer.start();    if (tileX > -1 && tileY > -1 && mapnum >= 0)        { builder.buildSingleTile(mapnum, tileX, tileY); }    else     {        if (num_threads && builder.activate(num_threads)== -1)        {            if (!silent)              { printf(" Thread initialization was not ok. The build is single threaded/n"); }        }        if (builder.activated())          { printf(" Using %d thread(s) for building/n", num_threads);}        if (mapnum >= 0)          { builder.buildMap(uint32(mapnum), true); }        else          { builder.buildAllMaps(); }    }    timer.stop();    timer.elapsed_time(elapsed);    printf(" /n Total build time: %ld seconds/n/n", elapsed.sec());        return silent ? 1 : finish(" Movemap build is complete! Press enter to exit/n", 1);}
开发者ID:H0zen,项目名称:Extractor_projects,代码行数:76,


示例7: octetSeq

intClient::svc (void){  try    {      Octet_Seq octetSeq(SIZE_BLOCK);      Char_Seq charSeq(SIZE_BLOCK);      ACE_High_Res_Timer timer;      ACE_OS::printf("Start sending %d Msgs.../n",this->niterations_);      charSeq.length(SIZE_BLOCK);      octetSeq.length(SIZE_BLOCK);      // This sets up the connector, so that we do not incur      // the overhead on the first call in the loop.      server_->sendCharSeq (charSeq);      timer.start ();      ACE_UINT32 client_count = 0;      for (ACE_UINT32 i = 0; i < this->niterations_; ++i)        {          client_count++;          server_->sendCharSeq (charSeq);          //server_->sendOctetSeq (octetSeq);          //ACE_DEBUG ((LM_DEBUG, "."));        }      timer.stop ();      ACE_Time_Value measured;      timer.elapsed_time (measured);      //ACE_DEBUG ((LM_DEBUG, "...finished/n"));      time_t dur = measured.sec () * 1000000 + measured.usec ();      if (dur == 0 || this->niterations_ == 0)        ACE_DEBUG ((LM_DEBUG, "Time not measurable, calculation skipped/n"));      else      {        ACE_DEBUG ((LM_DEBUG,                    "Time for %u Msgs: %u usec/n",                    this->niterations_,                    dur));        ACE_DEBUG ((LM_DEBUG, "Time for 1 Msg: %u usec, %u calls/sec/n",                    dur / this->niterations_,                    1000000 / (dur / this->niterations_)));      }      for (int c = 0; c < 10; ++c)        server_->shutdown ();    }  catch (const CORBA::Exception& ex)    {      ex._tao_print_exception ("MT_Client: exception raised");    }  return 0;}
开发者ID:DOCGroup,项目名称:ACE_TAO,代码行数:62,


示例8: ACE_TMAIN

// client main function// uses a portable form of the "main" function along with its argumentsint ACE_TMAIN (int argc, ACE_TCHAR *argv[]){   // first declare the variables  string server_host;             // name of the server  unsigned short port_num;        // port number is unsigned short  unsigned short proto_type = 0;  // 0 is our dummy implementation  size_t  chunk_size = 256;       // chunk size (default = 256)  FileTransferClient  ftpClient;  // instantiate an object for file                                  // transfer  string fname;                   // name of file to transfer  // we require the user to pass 4 arguments to the executable in that order  // (1) the server host name   // (2) server port number   // (3) protocol to use for reliable transfer (choices are 1, 2 or 3)  // (4) chunk size to use (optional)  if (argc < 4) {    ACE_ERROR ((LM_ERROR,                ACE_TEXT ("Usage: client <server hostname> <server port num> ")                ACE_TEXT ("<proto type: 1 = RDT, ")                ACE_TEXT ("2 = Go Back N, 3 = Selective Repeat> ")                ACE_TEXT ("[<chunk size, default = 256>]/n")));    return -1;  }  // let us grab the arguments  server_host = argv [1];  // note we have to convert to a number   port_num = (unsigned short) atoi (argv[2]);    // note we have to convert to a number   proto_type = (unsigned short) atoi (argv[3]);    // check if the user supplied a chunk size (the 4th argument)  if (argc == 5) {      chunk_size = (unsigned short) atoi (argv[4]);    }  ACE_DEBUG ((LM_DEBUG,              ACE_TEXT ("[%P] Client - ")              ACE_TEXT ("Server = %s, port = %d, proto = %d, ")              ACE_TEXT ("Chunk size = %d/n"),              server_host.c_str (), port_num, proto_type, chunk_size));  // ask the user to enter a file name  cout << "Please enter name of the file to transfer: ";  cin >> fname;  /*********************** TO-DO *************************************/  // I will suggest that you upgrade the FileTransferClient class so  // that it can keep a record of time taken against the chunk size and  // the protocol type used.  //  // Moreover the following can be inserted into a loop where the server  // host & port num stays same but you can vary both the proto type as  // well as chunk size and find out the time it takes to send the same  // file. Choose a file that is sufficiently large to show us some  // variations.   /*******************************************************************/  // now initialize the File Transfer object  if (ftpClient.open (server_host,                      port_num,                      proto_type,                      chunk_size) == -1) {    ACE_ERROR ((LM_ERROR,                ACE_TEXT ("[%P] client main - ")                ACE_TEXT ("failed to open the object (%m)/n")));    return -1;  }  // now let us time the transfer  ACE_High_Res_Timer  timer;  // start timing  timer.start ();    size_t bytesTransferred;  // keeps track of how many bytes were                            // transferred   if ((bytesTransferred = ftpClient.SendFile (fname)) == -1) {    ACE_ERROR ((LM_ERROR,                ACE_TEXT ("[%P] client main - ")                ACE_TEXT ("failed to send file (%m)/n")));    return -1;  }    // time the transfer and retrieve elapsed time.  timer.stop ();  ACE_Time_Value tv;  timer.elapsed_time (tv);  // since we are done, we close the ftp object so it can clean up its  // underlying protocol object.   if (ftpClient.close () == -1) {//.........这里部分代码省略.........
开发者ID:IMCG,项目名称:cpptruths,代码行数:101,


示例9: ACE_TMAIN

intACE_TMAIN (int argc, ACE_TCHAR *argv[]){  ACE_Time_Value timeout (ACE_DEFAULT_TIMEOUT);  //unsigned char selector = ACE_ATM_Addr::DEFAULT_SELECTOR;  //int selector_specified = 0;  if (argc > 2)    ACE_ERROR_RETURN ((LM_ERROR,                       "Usage: %s [selector]/n",                       argv[0]),                      1);  // Create a server address.  ACE_ATM_Addr addr;  //if (selector_specified)  unsigned char selector = ( argc == 2 ) ? ACE_OS::atoi( argv[ 1 ]) : ACE_ATM_Addr::DEFAULT_SELECTOR;  addr.set_selector( selector );  ACE_OS::printf( "ATM_Server: selector changed to %d/n", addr.get_selector());  // Create a server, reuse the addr.  ACE_ATM_Acceptor  peer_acceptor;  ACE_ATM_Params    params;  // Not sure why but reuse_addr set to true/1 causes problems for  // FORE/XTI/ATM - this is now handled in ACE_ATM_Acceptor::open()  ACE_HANDLE ret = peer_acceptor.open (addr, 5, params);  if ( ret == ACE_INVALID_HANDLE )    ACE_ERROR_RETURN ((LM_ERROR,                       "%p/n",                       "open"),                      -1);  ACE_ATM_Stream new_stream;  ACE_ATM_Addr local_addr;  local_addr.set_selector( selector );  peer_acceptor.get_local_addr( local_addr );  ACE_DEBUG ((LM_DEBUG,              "starting server at address %s/n",              local_addr.addr_to_string ()));  // Performs the iterative server activities  char buf[BUFSIZ];  ACE_High_Res_Timer timer;  int total;  ACE_Time_Value tv;  double real_time;  double actual_rate;  for (;;)  {    // Create a new ACE_ATM_Stream endpoint (note automatic restart    // if errno == EINTR).    ACE_OS::printf( "ATM_Server: expecting clients/n" );    if (peer_acceptor.accept (new_stream,                              &addr,                              &timeout) == -1)    {      ACE_ERROR ((LM_ERROR,                  "%p/n",                  "accept"));      continue;    }    ACE_OS::printf( "ATM_Server: got a connection/n" );    ACE_UINT16 vpi, vci;    vpi = vci = 0;    // This has problem on PMP connections on NT    //new_stream.get_vpi_vci(vpi, vci);    ACE_DEBUG ((LM_DEBUG,                "connected to VPI %d VCI %d/n",                vpi, vci));    ACE_OS::printf( "ATM_Server: connection accepted/n" );    ACE_DEBUG ((LM_DEBUG,                "client %s connected/n",                addr.addr_to_string ()));    ACE_DEBUG ((LM_DEBUG,                "client %s connected to host/n",                new_stream.get_peer_name ()));    // Read data from client (terminate on error).    int recvd = 0;    for ( ;; )    {      total = 0;      timer.start_incr();      for (int r_bytes;           (r_bytes = new_stream.recv (buf, sizeof buf, 0)) > 0; )//.........这里部分代码省略.........
开发者ID:CCJY,项目名称:ACE,代码行数:101,


示例10: ACE_TMAIN

intACE_TMAIN (int argc, ACE_TCHAR *argv[]){  int result = parse_args (argc, argv);  if (result != 0)    {      return result;    }  Synchronisers synch_forms;  ACE_High_Res_Timer::calibrate ();  // Leader Followers.  Leader_Follower_Task **leader_followers = 0;  ACE_NEW_RETURN (leader_followers,                  Leader_Follower_Task *[number_of_threads],                  -1);  int priority =    ACE_Sched_Params::priority_max (ACE_SCHED_FIFO);  long flags = THR_SCOPE_PROCESS;  // Number of messages left = Number_Of_messages  number_of_messages_left = number_of_messages;  size_t i = 0;  // Create and activate them.  for (i = 0; i < number_of_threads; ++i)    {      ACE_NEW_RETURN (leader_followers[i],                      Leader_Follower_Task (synch_forms),                      -1);      // Activate the leader_followers.      result = leader_followers[i]->activate (flags,                                              1,                                              1,                                              priority);      if (result != 0)        {          ACE_DEBUG ((LM_DEBUG,                      "(%P|%t) - Activate failed  for RT class "                      " - Using default priority for thread [%d]/n",                      i));          flags = THR_BOUND;          priority = ACE_Sched_Params::priority_min (ACE_SCHED_OTHER,                                                     ACE_SCOPE_THREAD);          // Activate the leader_followers.          result = leader_followers[i]->activate (flags,                                                  1,                                                  1,                                                  priority);          if (result != 0)            {              ACE_DEBUG ((LM_DEBUG,                          "(%P|%t) - Failed again no hope/n"));              return 0;            }        }    }  // Wait for all threads to terminate.  result = ACE_Thread_Manager::instance ()->wait ();  ACE_hrtime_t elapsed_time = 0;  test_timer.elapsed_time (elapsed_time);  double elapsed_time_per_invocation =    static_cast<double> (        ACE_UINT64_DBLCAST_ADAPTER (elapsed_time / number_of_messages)      );  ACE_DEBUG ((LM_DEBUG,              "(%P|%t) Throughput is [%f]/n",              1000000000/ elapsed_time_per_invocation));  for (i = 0; i < number_of_threads; ++i)    {      ACE_DEBUG ((LM_DEBUG,                  "Message consumed in thread [%d] is [%d]/n",                  i, leader_followers[i]->processed ()));      delete leader_followers[i];    }  delete[] leader_followers;  return result;}
开发者ID:asdlei00,项目名称:ACE,代码行数:98,


示例11: ACE_TMAIN

intACE_TMAIN (int argc, ACE_TCHAR *argv[]){  int result = parse_args (argc, argv);  if (result != 0)    {      return result;    }  ACE_High_Res_Timer::calibrate ();  // Create the message queue  Message_Queue input_message_queue;  Message_Queue output_message_queue;  // Create the datablocks. IF we use the default Message Blocks Ctor,  // it is going to do an extra allocation for the data block  ACE_NEW_RETURN (data_block,                  ACE_Locked_Data_Block<ACE_Lock_Adapter<ACE_SYNCH_MUTEX> >,                  -1);  // Increment the reference count so that we can share the  // datablock. This is donw twice the number of messages for the  // input and output queues.  size_t i = 0;  for (i = 0; i < 2*number_of_messages; ++i)    {      data_block->duplicate ();    }  // Create the Synchronisers  Synchronisers synch;  // Workers.  Worker_Task **workers = 0;  ACE_NEW_RETURN (workers,                  Worker_Task *[number_of_workers],                  -1);  // Input Task  Input_Task input_task (&input_message_queue,                         synch);  // Output Task  Output_Task output_task (&output_message_queue,                           synch);  int priority =    ACE_Sched_Params::priority_max (ACE_SCHED_FIFO);  long flags = THR_SCHED_FIFO | THR_SCOPE_PROCESS;  // Create and activate the worker threads  for (i = 0; i < number_of_workers; ++i)    {      ACE_NEW_RETURN (workers[i],                      Worker_Task (&input_message_queue, synch),                      -1);      workers[i]->next (&output_task);      // Activate the workers.      result = workers[i]->activate (flags,                                     1,                                     1,                                     priority);      if (result != 0)        {          flags = THR_BOUND;          priority = ACE_Sched_Params::priority_min (ACE_SCHED_OTHER,                                                     ACE_SCOPE_THREAD);          result = workers[i]->activate (flags,                                         1,                                         1,                                         priority);          if (result != 0)            {              return result;            }        }    }  // Activate the input and output threads  result = input_task.activate (flags,                                1,                                1,                                priority);  if (result != 0)    return result;  // Activate the workers.  result = output_task.activate (flags,                                 1,                                 1,//.........这里部分代码省略.........
开发者ID:azraelly,项目名称:knetwork,代码行数:101,


示例12: ACE_TMAIN

intACE_TMAIN(int argc, ACE_TCHAR *argv[]){  int n = 100;  int low = 64;  int hi = 4096;  int s = 4;  int quiet = 0;  ACE_Get_Opt get_opt (argc, argv, ACE_TEXT("dn:l:h:s:q"));  int opt;  while ((opt = get_opt ()) != EOF)    {      switch (opt)        {        case 'd':          TAO_debug_level++;          break;        case 'n':          n = ACE_OS::atoi (get_opt.opt_arg ());          break;        case 'l':          low = ACE_OS::atoi (get_opt.opt_arg ());          break;        case 'h':          hi = ACE_OS::atoi (get_opt.opt_arg ());          break;        case 's':          s = ACE_OS::atoi (get_opt.opt_arg ());          break;        case 'q':          quiet = 1;          break;        case '?':        default:          ACE_DEBUG ((LM_DEBUG,                      "Usage: %s "                      "-d debug"                      "-l low "                      "-h high "                      "-s step "                      "-n n "                      "/n"                      "Writes and then reads longs to a CDR stream "                      "starting from <low> up to <high> incrementing "                      "by <step>, at each step run <n> iterations to "                      "average."                      "/n",                      argv[0]));          return -1;        }    }  for (int x = low; x <= hi; x += s)    {      ACE_High_Res_Timer writing;      ACE_High_Res_Timer reading;      if (TAO_debug_level > 0)        ACE_DEBUG ((LM_DEBUG, "/nx= %d/n", x));      for (int i = 0; i < n; ++i)        {          writing.start_incr ();          TAO_OutputCDR output;          if (test_write (output, x) != 0)            {              return 1;            }          writing.stop_incr ();          reading.start_incr ();          TAO_InputCDR input (output);          if (test_read (input, x) != 0)            {              return 1;            }          reading.stop_incr ();        }      double m = n * x;      ACE_Time_Value wtv;      writing.elapsed_time_incr (wtv);      ACE_hrtime_t wusecs = wtv.sec ();      wusecs *= static_cast<ACE_UINT32> (ACE_ONE_SECOND_IN_USECS);      wusecs += wtv.usec ();      ACE_Time_Value rtv;      reading.elapsed_time_incr (rtv);      ACE_hrtime_t rusecs = rtv.sec ();      rusecs *= static_cast<ACE_UINT32> (ACE_ONE_SECOND_IN_USECS);      rusecs += rtv.usec ();      double write_average = ACE_HRTIME_CONVERSION(wusecs) / m;      double read_average = ACE_HRTIME_CONVERSION(rusecs) / m;      if (!quiet)        ACE_OS::printf ("AVE: %d %f %f/n",                        x, write_average, read_average);    }//.........这里部分代码省略.........
开发者ID:OspreyHub,项目名称:ATCD,代码行数:101,


示例13: sizeof

CORBA::LongSimple_Server_i::test_method (CORBA::Long exec_duration){  ACE_hthread_t thr_handle;  ACE_Thread::self (thr_handle);  int prio;  int guid;  RTScheduling::Current::IdType_var id = this->current_->id ();  ACE_OS::memcpy (&guid,                  id->get_buffer (),                  sizeof (id->length ()));  ACE_High_Res_Timer timer;  ACE_Time_Value elapsed_time;  ACE_DEBUG ((LM_DEBUG, "Request in thread %t/n"));  if (ACE_Thread::getprio (thr_handle, prio) == -1)    {      if (errno == ENOTSUP)        {          ACE_DEBUG((LM_DEBUG,                     ACE_TEXT ("getprio not supported on this platform/n")));          return 0;        }      ACE_ERROR_RETURN ((LM_ERROR,                         ACE_TEXT ("%p/n"),                         ACE_TEXT ("getprio failed")),                        -1);    }  ACE_DEBUG ((LM_DEBUG,              "Request in thread %t, prio = %d,"              "exec duration = %u/n", prio, exec_duration));  static CORBA::ULong prime_number = 9619899;  ACE_Time_Value compute_count_down_time (exec_duration, 0);  ACE_Countdown_Time compute_count_down (&compute_count_down_time);  //Applicable only for CV based implementations  //yield every 1 sec  ACE_Time_Value yield_interval (1,0);  ACE_Time_Value yield_count_down_time (yield_interval);  ACE_Countdown_Time yield_count_down (&yield_count_down_time);  timer.start ();  int j=0;  while (compute_count_down_time > ACE_Time_Value::zero)    {      ACE::is_prime (prime_number,                     2,                     prime_number / 2);      ++j;#ifdef KOKYU_DSRT_LOGGING      if (j%1000 == 0)        {          ACE_DEBUG ((LM_DEBUG,            "(%t|%T) loop # = %d, load = %usec/n", j, exec_duration));        }#endif      if (j%1000 == 0)        {          ACE_Time_Value run_time = ACE_OS::gettimeofday ();          task_stats_.sample (ACE_UINT32 (run_time.msec ()), guid);        }      compute_count_down.update ();      if (enable_yield_)        {          yield_count_down.update ();          if (yield_count_down_time <= ACE_Time_Value::zero)            {              CORBA::Policy_var sched_param_policy =                current_->scheduling_parameter();              const char * name = 0;              CORBA::Policy_ptr implicit_sched_param = 0;              current_->update_scheduling_segment (name,                                                   sched_param_policy.in (),                                                   implicit_sched_param);              yield_count_down_time = yield_interval;              yield_count_down.start ();            }        }    }  timer.stop ();  timer.elapsed_time (elapsed_time);  ACE_DEBUG ((LM_DEBUG,              "Request processing in thread %t done, "              "prio = %d, load = %d, elapsed time = %umsec/n",//.........这里部分代码省略.........
开发者ID:asdlei00,项目名称:ACE,代码行数:101,


示例14: ACE_TMAIN

//.........这里部分代码省略.........  std::string hostname;  Net_Common_Tools::retrieveLocalHostname (hostname);  if (IRC_CLIENT_CNF_IRC_USERMSG_TRADITIONAL)  {    configuration.protocolConfiguration.loginOptions.user.hostname.discriminator =      RPG_Net_Protocol_IRCLoginOptions::User::Hostname::STRING;    configuration.protocolConfiguration.loginOptions.user.hostname.string = &hostname;  } // end IF  else  {    configuration.protocolConfiguration.loginOptions.user.hostname.discriminator =      RPG_Net_Protocol_IRCLoginOptions::User::Hostname::BITMASK;    // *NOTE*: hybrid-7.2.3 seems to have a bug: 4 --> +i    configuration.protocolConfiguration.loginOptions.user.hostname.mode =      IRC_CLIENT_DEF_IRC_USERMODE;  } // end ELSE  configuration.protocolConfiguration.loginOptions.user.servername =    ACE_TEXT_ALWAYS_CHAR (RPG_NET_PROTOCOL_DEF_IRC_SERVERNAME);  configuration.protocolConfiguration.loginOptions.channel =    ACE_TEXT_ALWAYS_CHAR (IRC_CLIENT_DEF_IRC_CHANNEL);  // populate user/realname  Common_Tools::getCurrentUserName (configuration.protocolConfiguration.loginOptions.user.username,                                    configuration.protocolConfiguration.loginOptions.user.realname);  // step1db: parse config file (if any)  std::string serverHostname      = ACE_TEXT_ALWAYS_CHAR(IRC_CLIENT_DEF_SERVER_HOSTNAME);  unsigned short serverPortNumber = IRC_CLIENT_DEF_SERVER_PORT;  if (!configuration_file.empty ())    do_parseConfigurationFile (configuration_file,                               configuration.protocolConfiguration.loginOptions,                               serverHostname,                               serverPortNumber);  ACE_High_Res_Timer timer;  timer.start();  // step2: do actual work  do_work (configuration,           serverHostname,           serverPortNumber,           num_thread_pool_threads);  // clean up  IRC_handler_module.close ();  timer.stop ();  // debug info  std::string working_time_string;  ACE_Time_Value working_time;  timer.elapsed_time (working_time);  Common_Tools::period2String (working_time,                               working_time_string);  ACE_DEBUG ((LM_DEBUG,              ACE_TEXT ("total working time (h:m:s.us): /"%s/".../n"),              ACE_TEXT (working_time_string.c_str ())));  // stop profile timer...  process_profile.stop ();  // only process profile left to do...  ACE_Profile_Timer::ACE_Elapsed_Time elapsed_time;  elapsed_time.real_time = 0.0;  elapsed_time.user_time = 0.0;  elapsed_time.system_time = 0.0;  if (process_profile.elapsed_time (elapsed_time) == -1)  {    ACE_DEBUG ((LM_ERROR,
开发者ID:bhutnath,项目名称:yarp,代码行数:67,


示例15: ACE_TMAIN

//.........这里部分代码省略.........        return EXIT_FAILURE;    } // end IF    // step1c: initialize logging and/or tracing    std::string log_file;    if (!Common_Tools::initializeLogging (ACE::basename (argv_in[0]), // program name                                          log_file,                  // logfile                                          false,                     // log to syslog ?                                          false,                     // trace messages ?                                          trace_information,         // debug messages ?                                          NULL))                     // logger    {        ACE_DEBUG ((LM_ERROR,                    ACE_TEXT ("failed to RPG_Common_Tools::initLogging(), aborting/n")));        // *PORTABILITY*: on Windows, fini ACE...#if defined (ACE_WIN32) || defined (ACE_WIN64)        if (ACE::fini () == -1)            ACE_DEBUG ((LM_ERROR,                        ACE_TEXT ("failed to ACE::fini(): /"%m/", aborting/n")));#endif        return EXIT_FAILURE;    } // end IF    // step1d: handle specific program modes    if (print_version_and_exit)    {        do_printVersion (ACE::basename (argv_in[0]));        return EXIT_SUCCESS;    } // end IF    // step2: init SDL    if (SDL_Init (SDL_INIT_TIMER |                  SDL_INIT_AUDIO |                  SDL_INIT_CDROM |                  SDL_INIT_NOPARACHUTE) == -1) // "...Prevents SDL from catching fatal signals..."    {        ACE_DEBUG ((LM_ERROR,                    ACE_TEXT ("failed to SDL_Init(): /"%s/", aborting/n"),                    ACE_TEXT (SDL_GetError ())));        // *PORTABILITY*: on Windows, we must fini ACE...#if defined (ACE_WIN32) || defined (ACE_WIN64)        if (ACE::fini () == -1)            ACE_DEBUG ((LM_ERROR,                        ACE_TEXT ("failed to ACE::fini(): /"%m/", continuing/n")));#endif        return EXIT_FAILURE;    } // end IF    // ***** keyboard setup *****    // enable Unicode translation    SDL_EnableUNICODE (1);    // enable key repeat    SDL_EnableKeyRepeat (SDL_DEFAULT_REPEAT_DELAY,                         SDL_DEFAULT_REPEAT_INTERVAL);//   // ignore keyboard events//   SDL_EventState(SDL_KEYDOWN, SDL_IGNORE);//   SDL_EventState(SDL_KEYUP, SDL_IGNORE);//   // SDL event filter (filter mouse motion events and the like)//   SDL_SetEventFilter(event_filter_SDL_cb);    // step3: do actual work    ACE_High_Res_Timer timer;    timer.start ();    do_work (dump_dictionary,             sound_directory,             play_random_sounds,             schema_repository,             filename,             validate_XML);    timer.stop ();    // debug info    std::string working_time_string;    ACE_Time_Value working_time;    timer.elapsed_time (working_time);    Common_Tools::period2String (working_time,                                 working_time_string);    ACE_DEBUG ((LM_DEBUG,                ACE_TEXT ("total working time (h:m:s.us): /"%s/".../n"),                ACE_TEXT (working_time_string.c_str ())));    // step4a: fini SDL    SDL_Quit ();    // *PORTABILITY*: on Windows, fini ACE...#if defined (ACE_WIN32) || defined (ACE_WIN64)    if (ACE::fini () == -1)    {        ACE_DEBUG ((LM_ERROR,                    ACE_TEXT ("failed to ACE::fini(): /"%m/", aborting/n")));        return EXIT_FAILURE;    } // end IF#endif    return EXIT_SUCCESS;} // end main
开发者ID:bhutnath,项目名称:yarp,代码行数:101,


示例16: run_domain_test

//.........这里部分代码省略.........  TEST_CHECK (! CORBA::is_nil (widened_topic.in ()));  ACE_DEBUG((LM_DEBUG,    ACE_TEXT("(%P|%t) run_domain_test: ")    ACE_TEXT("(! CORBA::is_nil (widened_topic.in ()))")    ACE_TEXT("/n")  ));  ACE_ERROR((LM_ERROR,    "We expect to see an error message from delete_participant/n"));  ret = dpf->delete_participant(new_dp.in ());  TEST_CHECK (ret == ::DDS::RETCODE_PRECONDITION_NOT_MET);  ACE_DEBUG((LM_DEBUG,    ACE_TEXT("(%P|%t) run_domain_test: ")    ACE_TEXT("(ret == ::DDS::RETCODE_PRECONDITION_NOT_MET)")    ACE_TEXT("/n")  ));  // delete existent topic first time  ret = new_dp->delete_topic(found_topic.in ());  TEST_CHECK (ret == ::DDS::RETCODE_OK);  ACE_DEBUG((LM_DEBUG,    ACE_TEXT("(%P|%t) run_domain_test: ")    ACE_TEXT("(ret == ::DDS::RETCODE_OK)")    ACE_TEXT("/n")  ));  // delete existent topic second time  ret = new_dp->delete_topic(new_topic.in ());  TEST_CHECK (ret == ::DDS::RETCODE_OK);  ACE_DEBUG((LM_DEBUG,    ACE_TEXT("(%P|%t) run_domain_test: ")    ACE_TEXT("(ret == ::DDS::RETCODE_OK)")    ACE_TEXT("/n")  ));  // an extra delete existent topic  ACE_ERROR((LM_ERROR,    "We expect to see an error message from delete_topic/n"));  ret = new_dp->delete_topic(new_topic.in ());  TEST_CHECK (ret == ::DDS::RETCODE_ERROR);  ACE_DEBUG((LM_DEBUG,    ACE_TEXT("(%P|%t) run_domain_test: ")    ACE_TEXT("(ret == ::DDS::RETCODE_ERROR)")    ACE_TEXT("/n")  ));  // Look up the topicdescription after the topic is deleted will  // return nil.  found_topicdescription    = new_dp->lookup_topicdescription(MY_TOPIC);  TEST_CHECK (CORBA::is_nil(found_topicdescription.in ()));  ACE_DEBUG((LM_DEBUG,    ACE_TEXT("(%P|%t) run_domain_test: ")    ACE_TEXT("(CORBA::is_nil(found_topicdescription.in ()))")    ACE_TEXT("/n")  ));  // find a non-existent topic - return nil  ACE_High_Res_Timer timer;  ACE_Time_Value elapsedTime(0, 0);  timer.start ();  found_topic = new_dp->find_topic(OTHER_TOPIC, timeout);  timer.stop();  timer.elapsed_time(elapsedTime);  ACE_Time_Value tenMillis (0, 10000);  elapsedTime += tenMillis;  // some systems can be short by up to 10 milliseconds  ACE_DEBUG((LM_DEBUG,    ACE_TEXT("(%P|%t) run_domain_test: ")    ACE_TEXT("(CORBA::is_nil(found_topic.in ()) && elapsedTime.msec() >= find_topic_timeout.msec())")    ACE_TEXT("/n")  ));  // delete the existent participant  ret = dpf->delete_participant(new_dp.in ());  TEST_CHECK (ret == ::DDS::RETCODE_OK);  ACE_DEBUG((LM_DEBUG,    ACE_TEXT("(%P|%t) run_domain_test: ")    ACE_TEXT("(ret == ::DDS::RETCODE_OK)")    ACE_TEXT("/n")  ));  // lookup the participant after it's deleted - return nil  looked_dp = dpf->lookup_participant(MY_DOMAIN);  TEST_CHECK (CORBA::is_nil(looked_dp.in ()));  ACE_DEBUG((LM_DEBUG,    ACE_TEXT("(%P|%t) run_domain_test: ")    ACE_TEXT("(CORBA::is_nil(looked_dp.in ()))")    ACE_TEXT("/n")  ));  return 0;}
开发者ID:svn2github,项目名称:OpenDDS,代码行数:101,


示例17: ACE_TMAIN

//.........这里部分代码省略.........  {    // make 'em learn...    do_printUsage (ACE::basename (argv_in[0]));    // clean up    // *PORTABILITY*: on Windows, need to fini ACE...#if defined (ACE_WIN32) || defined (ACE_WIN64)    if (ACE::fini () == -1)      ACE_DEBUG ((LM_ERROR,                  ACE_TEXT ("failed to ACE::fini(): /"%m/", continuing/n")));#endif    return EXIT_FAILURE;  } // end IF  // step1bb: validate arguments  if (!Common_File_Tools::isReadable (map_file) ||      !Common_File_Tools::isDirectory (schema_directory))  {    // make 'em learn...    do_printUsage (ACE::basename (argv_in[0]));    // clean up    // *PORTABILITY*: on Windows, need to fini ACE...#if defined (ACE_WIN32) || defined (ACE_WIN64)    if (ACE::fini () == -1)      ACE_DEBUG ((LM_ERROR,                  ACE_TEXT ("failed to ACE::fini(): /"%m/", continuing/n")));#endif    return EXIT_FAILURE;  } // end IF  // step1c: initialize logging and/or tracing  std::string log_file;  if (!Common_Tools::initializeLogging (ACE::basename (argv_in[0]),   // program name                                        log_file,                    // logfile                                        false,                       // log to syslog ?                                        false,                       // trace messages ?                                        trace_information,           // debug messages ?                                        NULL))                       // logger  {    ACE_DEBUG ((LM_ERROR,                ACE_TEXT ("failed to Common_Tools::initializeLogging(), aborting/n")));    // clean up    // *PORTABILITY*: on Windows, need to fini ACE...#if defined (ACE_WIN32) || defined (ACE_WIN64)    if (ACE::fini () == -1)      ACE_DEBUG ((LM_ERROR,                  ACE_TEXT ("failed to ACE::fini(): /"%m/", continuing/n")));#endif    return EXIT_FAILURE;  } // end IF  // step1d: handle specific program modes  if (print_version_and_exit)  {    do_printVersion (ACE::basename (argv_in[0]));    // clean up    // *PORTABILITY*: on Windows, need to fini ACE...#if defined (ACE_WIN32) || defined (ACE_WIN64)    if (ACE::fini () == -1)      ACE_DEBUG ((LM_ERROR,                  ACE_TEXT ("failed to ACE::fini(): /"%m/", continuing/n")));#endif    return EXIT_SUCCESS;  } // end IF  ACE_High_Res_Timer timer;  timer.start ();  // step2: do actual work  do_work (schema_directory,           debug_scanner,           debug_parser,           map_file);  timer.stop ();  // debug info  std::string working_time_string;  ACE_Time_Value working_time;  timer.elapsed_time (working_time);  RPG_Common_Tools::period2String (working_time,                                   working_time_string);  ACE_DEBUG ((LM_DEBUG,              ACE_TEXT ("total working time (h:m:s.us): /"%s/".../n"),              ACE_TEXT (working_time_string.c_str ())));  // *PORTABILITY*: on Windows, need to fini ACE...#if defined (ACE_WIN32) || defined (ACE_WIN64)  if (ACE::fini () == -1)    ACE_DEBUG ((LM_ERROR,                ACE_TEXT ("failed to ACE::fini(): /"%m/", continuing/n")));#endif  return EXIT_SUCCESS;}
开发者ID:bhutnath,项目名称:yarp,代码行数:101,


示例18: big_time_test

void big_time_test (CORBA::ULong num_list_loops,                    CORBA::ULong num_seq_loops,                    CORBA::ULong num_string_loops,                    bool use_long_str){  ACE_High_Res_Timer timer;  ACE_hrtime_t time;  Seq_Structs big_list;  big_list.seq.length(0);  CORBA::ULong big_len;  CORBA::ULong red_len;  CORBA::ULong sss_len;  CORBA::ULong str_len;  // start timing  timer.start();  for (CORBA::ULong list_idx = 0; list_idx < num_list_loops; ++list_idx)  {    big_len = big_list.seq.length();    big_list.seq.length(big_len + 1);    Biglist_Struct & list = big_list.seq[big_len];    for (CORBA::ULong seq_idx = 0; seq_idx < num_seq_loops; ++seq_idx)    {      red_len = list.red_seqs.length();      list.red_seqs.length(red_len + 1);      Sequence_Str_Sequences & sss = list.red_seqs[red_len];      sss_len = sss.seq_str_seq.length();      sss.seq_str_seq.length(sss_len + 1);      Str_Sequences & strs = sss.seq_str_seq[sss_len];      for (CORBA::ULong str_idx = 0; str_idx < num_string_loops; ++str_idx)      {        str_len = strs.second_str.length();        strs.second_str.length(str_len + 1);        strs.second_str[str_len] = use_long_str ? long_str : short_str;        str_len = list.strs.first_str.length();        list.strs.first_str.length(str_len + 1);        list.strs.first_str[str_len] = use_long_str ? long_str : short_str;      } // end of str loop    } // end of seq loop  } // end of list loop  // end timing  timer.stop();  timer.elapsed_time(time);  if (use_csv)    {      ACE_DEBUG((LM_INFO,                 ACE_TEXT("3, %u, %u, %u, %s, %Q/n"),                 num_list_loops,                 num_string_loops,                 num_seq_loops,                 use_long_str ? ACE_TEXT("long"): ACE_TEXT("short"),                 time ));    }  else    {      ACE_DEBUG((LM_INFO,                 ACE_TEXT("Big list test(%u, %u, %u, %s) = %Q ns/n"),                 num_list_loops,                 num_string_loops,                 num_seq_loops,                 use_long_str ? ACE_TEXT("long"): ACE_TEXT("short"),                 time ));    }}
开发者ID:OspreyHub,项目名称:ATCD,代码行数:75,


示例19: ACE_TMAIN

//.........这里部分代码省略.........                     params,                     qos,                     (ACE_Time_Value *) &ACE_Time_Value::zero,                     local_addr,                     0,                     0 ) == -1) {      if (errno != EWOULDBLOCK)	      ACE_ERROR_RETURN ((LM_ERROR,                          "%p/n",                          "ATM_Client: connection failed"),                          1);      ACE_DEBUG ((LM_DEBUG,                    "ATM_Client: starting timed connection/n"));      // Check if non-blocking connection is in progress, and wait up      // to timeout seconds for it to complete.      ACE_Time_Value tv (timeout);      ACE_OS::printf( "ATM_Client: connection completed/n" );      if (con.complete (atm_stream,                        &hosts[ 0 ],                        &tv) == -1)		    ACE_ERROR_RETURN ((LM_ERROR,                          "%p/n",                          "ATM_Client: connection failed"),                          1);      else		    ACE_DEBUG ((LM_DEBUG,                   "ATM_Client: connected to %s/n",		               hosts[ 0 ].addr_to_string()));    }  } else {    // Point-to-multipoint connection    for ( int i = 0; i < num_leaves; i++ ) {      con.add_leaf( atm_stream,                    hosts[ i ],                    i,                    0 );    }  } /* if num_leaves == 1 */  ACE_UINT16 vpi, vci;  atm_stream.get_vpi_vci(vpi, vci);  ACE_DEBUG ((LM_DEBUG,              "ATM_Client: connected to VPI %d VCI %d/n",              vpi, vci));  // Send data to server (correctly handles "incomplete writes").  int s_bytes;  int total;  int xmit = 0;  ACE_High_Res_Timer timer;  ACE_Time_Value elapsed;  double real_time;  double actual_rate;  for ( ;; ) {    total = 0;    timer.start_incr();    for ( ;; ) {      s_bytes = atm_stream.send_n( buf, BUFSIZ, 0 );      if ( s_bytes == -1 )        ACE_ERROR_RETURN ((LM_ERROR,                           "%p/n",                           "send_n"),                           1);      total += s_bytes;      if ( total >= session * pdu_size )        break;    }    timer.stop_incr();    timer.elapsed_time_incr( elapsed );    real_time = elapsed.sec() * ACE_ONE_SECOND_IN_USECS + elapsed.usec();    xmit += total;    actual_rate = ( double )xmit * ( double )8 / real_time;    ACE_DEBUG ((LM_DEBUG,                ACE_TEXT ("(%t) bytes = %d, usec = %f, rate = %0.00f Mbps/n"),                xmit,                real_time,                actual_rate < 0 ? 0 : actual_rate ));  }  // Explicitly close the connection.  ACE_OS::printf( "ATM_Client: close connection/n" );  if (atm_stream.close () == -1)    ACE_ERROR_RETURN ((LM_ERROR,                       "%p/n",                       "close"),                       -1);  return 0;}
开发者ID:azraelly,项目名称:knetwork,代码行数:101,


示例20: ACE_TMAIN

//.........这里部分代码省略.........                                        false,                      // log to syslog ?                                        false,                      // trace messages ?                                        trace_information,          // debug messages ?                                        NULL))                      // logger  {    ACE_DEBUG ((LM_ERROR,                ACE_TEXT ("failed to Common_Tools::initializeLogging(), aborting/n")));    // *PORTABILITY*: on Windows, need to fini ACE...#if defined (ACE_WIN32) || defined (ACE_WIN64)    if (ACE::fini () == -1)      ACE_DEBUG ((LM_ERROR,                  ACE_TEXT ("failed to ACE::fini(): /"%m/", continuing/n")));#endif    return EXIT_FAILURE;  } // end IF  // step4: handle specific program modes  if (print_version_and_exit)  {    do_printVersion (ACE::basename (argv_in[0]));    // *PORTABILITY*: on Windows, need to fini ACE...#if defined (ACE_WIN32) || defined (ACE_WIN64)    if (ACE::fini () == -1)      ACE_DEBUG ((LM_ERROR,                  ACE_TEXT ("failed to ACE::fini(): /"%m/", continuing/n")));#endif    return EXIT_SUCCESS;  } // end IF  ACE_High_Res_Timer timer;  timer.start ();  // step5: do work  RPG_Dice_Rolls_t combinations;  do_work (value_range,           combinations);  timer.stop ();  // step6: print results  // header line  std::cout << ACE_TEXT ("results ")            << RPG_Dice_Common_Tools::rangeToString (value_range)            << ACE_TEXT (": ")            << std::endl;  std::cout << std::setw (80)            << std::setfill (ACE_TEXT_ALWAYS_CHAR ('-'))            << ACE_TEXT ("")            << std::setfill (ACE_TEXT_ALWAYS_CHAR (' '))            << std::endl;  bool perfect_match = true;  int index = 1;  RPG_Dice_ValueRange range;  for (RPG_Dice_RollsIterator_t iterator = combinations.begin ();       iterator != combinations.end ();       iterator++, index++)  {    perfect_match = true;    RPG_Dice::rollToRange (*iterator, range);    if ((range.begin != value_range.begin) || (range.end != value_range.end))    {
开发者ID:bhutnath,项目名称:yarp,代码行数:67,


示例21:

intMutex_Acquire_Release_Test::svc (){#if ACE_DEBUG_CST > 0  ACE_hthread_t thread_id;  ACE_Thread_Manager::instance ()->thr_self (thread_id);  ACE_DEBUG ((LM_DEBUG,              "Mutex_Acquire_Release_Test::svc (), thread ID is %d/n",              thread_id));#endif /* ACE_DEBUG_CST */  timer_.start ();  for (ACE_UINT32 i = 0; i < iterations_; ++i)    {      // Block on the mutex.      ACE_GUARD_RETURN (ACE_Thread_Mutex, ace_mon, mutex_, -1);      // Release the mutex so that the low priority thread can      // proceed.  The ACE_GUARD_RETURN macro implicity releases the      // mutex.    }  timer_.stop ();  timer_.elapsed_time (elapsed_time_); /* nanoseconds */#if ACE_DEBUG_CST > 0  ACE_DEBUG ((LM_DEBUG, "Mutex_Acquire_Release_Test::svc, finishing/n"));#endif /* ACE_DEBUG_CST */  return 0;}
开发者ID:CCJY,项目名称:ACE,代码行数:33,


示例22:

intSynchronisers::end_synchronization (void){  // Hold the lock and increment the global variable to indicate  // number of ready threads  {    ACE_GUARD_RETURN (ACE_SYNCH_MUTEX, ace_mon, this->mutex_, -1);    ready_threads ++;    if (ready_threads == (number_of_workers + io_threads))      {        // Reset the ready_threads so that we can wait at the end of        // runs        ready_threads = 0;        // Start the timer        test_timer.stop ();        // Signal all the threads        this->event_.signal ();        if (debug)          {            ACE_DEBUG ((LM_DEBUG,                        "(%P|%t) Ended peacefully /n"));          }        // return to do our work;        return 0;      }    // If we are not the last thread, let go off the lock  }  if (debug)    {      ACE_DEBUG ((LM_DEBUG,                  "(%P|%t) Going to wait .. /n"));    }  // Wait blisfully till we are woken up  this->event_.wait ();  return 0;}
开发者ID:azraelly,项目名称:knetwork,代码行数:47,


示例23: defined

intYield_Test::svc (){#if ACE_DEBUG_CST > 0  ACE_DEBUG ((LM_DEBUG, "Yield_Test::svc (), entering"));  ACE_hthread_t thread_id;  ACE_Thread_Manager::instance ()->thr_self (thread_id);  int priority;  ACE_OS::thr_getprio (thread_id, priority);  ACE_DEBUG ((LM_DEBUG, "; thread ID is %u, priority is %u/n", thread_id,              priority));#endif /* ACE_DEBUG_CST */#if defined (VXWORKS)  // Start the timer, if it hasn't already been started.  if (! started_)    {      // Double-check.      ACE_GUARD_RETURN (ACE_Thread_Mutex, ace_mon, mutex_, -1);      if (! started_)        {          started_ = 1;          timer_.start ();        }    }#endif /* VXWORKS */  for (ACE_UINT32 i = 0; i < iterations_; ++i)    {#if ACE_DEBUG_CST > 0      if (i % (iterations_ >= 10  ?  iterations_ / 10  :  1) ==  0)        {          ACE_DEBUG ((LM_DEBUG, "Yield_Test::svc () [%u], iteration %u/n",                      thread_id, i));        }#endif /* ACE_DEBUG_CST */      ACE_OS::thr_yield ();    }#if defined (VXWORKS)  // Stop the timer, if it hasn't already been started.  if (! stopped_)    {      // Maybe it would be better to read the clock before grabbing      // the mutex.  Then, only apply the clock reading below, instead      // of reading the clock after grabbing the mutex.      // Double-check.      ACE_GUARD_RETURN (ACE_Thread_Mutex, ace_mon, mutex_, -1);      if (! stopped_)        {          stopped_ = 1;          timer_.stop ();          timer_.elapsed_time (elapsed_time_); /* nanoseconds */        }    }#else  /* ! VXWORKS */  timer_barrier_.wait ();#endif /* ! VXWORKS */#if ACE_DEBUG_CST > 0  ACE_DEBUG ((LM_DEBUG, "Yield_Test::svc, finishing/n"));#endif /* ACE_DEBUG_CST */  return 0;}
开发者ID:CCJY,项目名称:ACE,代码行数:72,


示例24: mutex_acquire_release_test

intSynchronized_Suspend_Resume_Test::svc (){#if ACE_DEBUG_CST > 0  ACE_DEBUG ((LM_DEBUG, "Synchronized_Suspend_Resume_Test::svc (), entering"));  ACE_hthread_t thread_id;  ACE_Thread_Manager::instance ()->thr_self (thread_id);  ACE_DEBUG ((LM_DEBUG, "; thread ID is %u/n", thread_id));#endif /* ACE_DEBUG_CST */  {    Mutex_Acquire_Release_Test mutex_acquire_release_test (num_iterations);    mutex_acquire_release_test.svc ();    mutex_acquire_release_time_ =      static_cast<ACE_UINT32> (mutex_acquire_release_test.elapsed_time () /                       num_iterations);#if ACE_DEBUG_CST > 0    ACE_DEBUG ((LM_DEBUG, "mutex_acquire_release: %u nsec/n",                mutex_acquire_release_time_));#endif /* ACE_DEBUG_CST */  }  high_.ready ();#if ACE_DEBUG_CST > 0  int priority, high_priority;  ACE_OS::thr_getprio (thread_id, priority);  ACE_OS::thr_getprio (high_.thread_id (), high_priority);  ACE_DEBUG ((LM_DEBUG,              "Synchronized_Suspend_Resume_Test::svc (), priority is %d, "              ", high thread priority is %d/n",              priority, high_priority));#endif /* ACE_DEBUG_CST */  // For information:  the cost of the just the loop itself below,  // without the suspend and resume calls, on a 166 MHz Ultrasparc  // is about 12.3 nanoseconds per iteration.  ACE_UINT32 i;  for (i = 0; i < iterations_; ++i)    {#if ACE_DEBUG_CST > 0      if (i % (iterations_ >= 10  ?  iterations_ / 10  :  1) ==  0)        {          ACE_DEBUG ((LM_DEBUG,                      "Synchronized_Suspend_Resume_Test::svc (), iteration "                      "%d, continue high-priority thread %u/n",                      i, high_.thread_id ()));        }#endif /* ACE_DEBUG_CST */      {        // Acquire the mutex so that the high priority thread will        // block after we signal it via the condition variable.        ACE_GUARD_RETURN (ACE_Thread_Mutex, ace_mon, mutex_, -1);        // Release the semaphore so that the high priority thread can        // proceed.        if (sem_.release () != 0)          ACE_ERROR_RETURN ((LM_ERROR, "%p/n", "sem_.release"), -1);        timer_.start ();        // Release the mutex so that the high priority thread can        // proceed.  The ACE_GUARD_RETURN macro implicity releases        // the mutex.      }    }  high_.done ();  // The high priority thread will be block on the semaphore, so  // release it.  if (sem_.release () != 0)    ACE_ERROR_RETURN ((LM_ERROR, "%p/n", "sem_.release"), -1);#if ACE_DEBUG_CST > 0  ACE_DEBUG ((LM_DEBUG,              "Synchronized_Suspend_Resume_Test::svc: told high priority "              "task to terminate/n"));#endif /* ACE_DEBUG_CST */  // Resume the thread until thr_continue fails, indicating that it has  // finished.  for (i = 0; i < 10000  &&  ! ACE_OS::thr_continue (high_.thread_id ());       ++i) /* null */;#if ACE_DEBUG_CST > 0  ACE_DEBUG ((LM_DEBUG, "Synchronized_Suspend_Resume_Test::svc, finishing/n"));#endif /* ACE_DEBUG_CST */  return 0;}
开发者ID:CCJY,项目名称:ACE,代码行数:96,



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


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