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


C++ Marker::sample方法代码示例

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


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

示例1: catch

void
run_test (Test_Interceptors::Secure_Vault_ptr server)
{
  int i = 0;
  const char user[] = "root";
  Marker marker;
  ACE_Throughput_Stats throughput;

  ACE_DEBUG ((LM_DEBUG, "High res. timer calibration...."));
  ACE_High_Res_Timer::global_scale_factor_type gsf =
    ACE_High_Res_Timer::global_scale_factor ();
  ACE_DEBUG ((LM_DEBUG, "done\n"));

  marker.accumulate_into (throughput, 1);
  ACE_hrtime_t throughput_base = ACE_OS::gethrtime ();
  for (i = 0; i < niterations ; ++i)
    {
      // Record current time.
      ACE_hrtime_t latency_base = ACE_OS::gethrtime ();

      server->ready ();

      // Grab timestamp again.
      ACE_hrtime_t now = ACE_OS::gethrtime ();

      // Record statistics.
      marker.sample (now - throughput_base,
                     now - latency_base,
                     1);

      if (TAO_debug_level > 0 && i % 100 == 0)
        ACE_DEBUG ((LM_DEBUG, "(%P|%t) iteration = %d\n", i));
    }

  marker.dump_stats (ACE_TEXT ("Ready method  "), gsf, 1);

  try
    {
      marker.accumulate_into (throughput, 2);
      throughput_base = ACE_OS::gethrtime ();

      for (i = 0; i < niterations ; ++i)
        {
          // Record current time.
          ACE_hrtime_t latency_base = ACE_OS::gethrtime ();

          server->authenticate (user);

          // Grab timestamp again.
          ACE_hrtime_t now = ACE_OS::gethrtime ();

          // Record statistics.
          marker.sample (now - throughput_base,
                         now - latency_base,
                         2);

          if (TAO_debug_level > 0 && i % 100 == 0)
            ACE_DEBUG ((LM_DEBUG, "(%P|%t) iteration = %d\n", i));
        }
      marker.dump_stats (ACE_TEXT ("Authenticate method  "), gsf, 2);
    }
  catch (const Test_Interceptors::Invalid&)
    {
      ACE_DEBUG ((LM_DEBUG, "Invalid user\n"));
    }

  Test_Interceptors::Secure_Vault::Record record;
  record.check_num = 1;
  record.amount = 1000;
  CORBA::Long id = 1;

  marker.accumulate_into (throughput, 3);
  throughput_base = ACE_OS::gethrtime ();

  for (i = 0; i < niterations ; ++i)
    {
      // Record current time.
      ACE_hrtime_t latency_base = ACE_OS::gethrtime ();

      server->update_records (id,
                              record);

      // Grab timestamp again.
      ACE_hrtime_t now = ACE_OS::gethrtime ();

      // Record statistics.
      marker.sample (now - throughput_base,
                     now - latency_base,
                     3);

      if (TAO_debug_level > 0 && i % 100 == 0)
        ACE_DEBUG ((LM_DEBUG, "(%P|%t) iteration = %d\n", i));

    }

  marker.dump_stats (ACE_TEXT ("update records  method  "), gsf, 3);
}
开发者ID:chenbk85,项目名称:ACE-Middleware,代码行数:97,代码来源:client.cpp


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