⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 anyop.cpp

📁 这是广泛使用的通信开源项目,对于大容量,高并发的通讯要求完全能够胜任,他广泛可用于网络游戏医学图像网关的高qos要求.更详细的内容可阅读相应的材料
💻 CPP
📖 第 1 页 / 共 2 页
字号:
                history.sample (now - start);

                Param_Test::Fixed_Struct *o;

                result = any >>= o;
              }
            else
              {
                any <<= i;

                Param_Test::Fixed_Struct *o;

                ACE_hrtime_t start = ACE_OS::gethrtime ();

                result = any >>= o;

                ACE_hrtime_t now = ACE_OS::gethrtime ();
                history.sample (now - start);
              }
          }

        ACE_hrtime_t test_end = ACE_OS::gethrtime ();

        if (insertion == 1)
          {
            ACE_DEBUG ((LM_DEBUG, 
                        "Struct non-copying insertion test finished\n"));
          }
        else
          {
            ACE_DEBUG ((LM_DEBUG, 
                        "Struct extraction test finished\n"));
          }

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

        ACE_Basic_Stats stats;
        history.collect_basic_stats (stats);
        stats.dump_results ("Total", gsf);

        ACE_Throughput_Stats::dump_throughput ("Total", 
											                         gsf,
                                               test_end - test_start,
                                               stats.samples_count ());
      }

      ACE_DEBUG ((LM_DEBUG, "\n"));
    
      {
        CORBA::ULong len = 1024;
        Param_Test::Long_Seq i (len);
        i.length (len);
        
        for (CORBA::ULong k = 0; k < len; ++k)
          {
            i[k] = 11;
          }

        ACE_Sample_History history (n);
        ACE_hrtime_t test_start = ACE_OS::gethrtime ();

        for (j = 0; j != n; ++j)
          {
            CORBA::Any any;

            if (insertion == 1)
              {
                ACE_hrtime_t start = ACE_OS::gethrtime ();

                any <<= i;

                ACE_hrtime_t now = ACE_OS::gethrtime ();
                history.sample (now - start);

                Param_Test::Long_Seq *o;

                result = any >>= o;
              }
            else
              {
                any <<= i;

                Param_Test::Long_Seq *o;

                ACE_hrtime_t start = ACE_OS::gethrtime ();

                result = any >>= o;

                ACE_hrtime_t now = ACE_OS::gethrtime ();
                history.sample (now - start);
              }
          }

        ACE_hrtime_t test_end = ACE_OS::gethrtime ();

        if (insertion == 1)
          {
            ACE_DEBUG ((LM_DEBUG, 
                        "Sequence copying insertion test finished\n"));
          }
        else
          {
            ACE_DEBUG ((LM_DEBUG, 
                        "Sequence extraction test finished\n"));
          }

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

        ACE_Basic_Stats stats;
        history.collect_basic_stats (stats);
        stats.dump_results ("Total", gsf);

        ACE_Throughput_Stats::dump_throughput ("Total", 
											                         gsf,
                                               test_end - test_start,
                                               stats.samples_count ());
      }

      ACE_DEBUG ((LM_DEBUG, "\n"));
    
      {
        CORBA::ULong len = 1024;
        ACE_Sample_History history (n);
        ACE_hrtime_t test_start = ACE_OS::gethrtime ();
        for (j = 0; j != n; ++j)
          {
            CORBA::Any any;
            Param_Test::Long_Seq *i = 0;
            ACE_NEW_RETURN (i,
                            Param_Test::Long_Seq (len),
                            -1);
            i->length (len);
            
            for (CORBA::ULong k = 0; k < len; ++k)
              {
                (*i)[k] = 11;
              }

            if (insertion == 1)
              {
                ACE_hrtime_t start = ACE_OS::gethrtime ();

                any <<= i;

                ACE_hrtime_t now = ACE_OS::gethrtime ();
                history.sample (now - start);

                Param_Test::Long_Seq *o;

                result = any >>= o;
              }
            else
              {
                any <<= i;

                Param_Test::Long_Seq *o;

                ACE_hrtime_t start = ACE_OS::gethrtime ();

                result = any >>= o;

                ACE_hrtime_t now = ACE_OS::gethrtime ();
                history.sample (now - start);
              }
          }

        ACE_hrtime_t test_end = ACE_OS::gethrtime ();

        if (insertion == 1)
          {
            ACE_DEBUG ((LM_DEBUG, 
                        "Sequence non-copying insertion test finished\n"));
          }
        else
          {
            ACE_DEBUG ((LM_DEBUG, 
                        "Sequence extraction test finished\n"));
          }

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

        ACE_Basic_Stats stats;
        history.collect_basic_stats (stats);
        stats.dump_results ("Total", gsf);

        ACE_Throughput_Stats::dump_throughput ("Total", 
											                         gsf,
                                               test_end - test_start,
                                               stats.samples_count ());
      }

      ACE_DEBUG ((LM_DEBUG, "\n"));
    
      {
        ACE_Sample_History history (n);
        ACE_hrtime_t test_start = ACE_OS::gethrtime ();

        for (j = 0; j != n; ++j)
          {
            CORBA::Any any;
            CORBA::Any i;
            i <<= CORBA::Short (123);

            if (insertion == 1)
              {
                ACE_hrtime_t start = ACE_OS::gethrtime ();

                any <<= i;

                ACE_hrtime_t now = ACE_OS::gethrtime ();
                history.sample (now - start);

                const CORBA::Any *o;
                CORBA::Short oo;

                result = any >>= o;
                result = *o >>= oo;
              }
            else
              {
                any <<= i;

                const CORBA::Any *o;
                CORBA::Short oo;

                ACE_hrtime_t start = ACE_OS::gethrtime ();

                result = any >>= o;

                ACE_hrtime_t now = ACE_OS::gethrtime ();
                history.sample (now - start);

                result = *o >>= oo;
              }
          }

        ACE_hrtime_t test_end = ACE_OS::gethrtime ();

        if (insertion == 1)
          {
            ACE_DEBUG ((LM_DEBUG, 
                        "Any copying insertion test finished\n"));
          }
        else
          {
            ACE_DEBUG ((LM_DEBUG, 
                        "Any extraction test finished\n"));
          }

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

        ACE_Basic_Stats stats;
        history.collect_basic_stats (stats);
        stats.dump_results ("Total", gsf);

        ACE_Throughput_Stats::dump_throughput ("Total", 
											                         gsf,
                                               test_end - test_start,
                                               stats.samples_count ());
      }

      ACE_DEBUG ((LM_DEBUG, "\n"));
    
      {
        ACE_Sample_History history (n);
        ACE_hrtime_t test_start = ACE_OS::gethrtime ();

        for (j = 0; j != n; ++j)
          {
            CORBA::Any any;
            CORBA::Any *i = 0;
            ACE_NEW_RETURN (i,
                            CORBA::Any,
                            -1);
            *i <<= CORBA::Short (123);

            if (insertion == 1)
              {
                ACE_hrtime_t start = ACE_OS::gethrtime ();

                any <<= i;

                ACE_hrtime_t now = ACE_OS::gethrtime ();
                history.sample (now - start);

                const CORBA::Any *o;
                CORBA::Short oo;

                result = any >>= o;
                result = *o >>= oo;
              }
            else
              {
                any <<= i;

                const CORBA::Any *o;
                CORBA::Short oo;

                ACE_hrtime_t start = ACE_OS::gethrtime ();

                result = any >>= o;

                ACE_hrtime_t now = ACE_OS::gethrtime ();
                history.sample (now - start);

                result = *o >>= oo;
              }
          }

        ACE_hrtime_t test_end = ACE_OS::gethrtime ();

        if (insertion == 1)
          {
            ACE_DEBUG ((LM_DEBUG, 
                        "Any non-copying insertion test finished\n"));
          }
        else
          {
            ACE_DEBUG ((LM_DEBUG, 
                        "Any extraction test finished\n"));
          }

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

        ACE_Basic_Stats stats;
        history.collect_basic_stats (stats);
        stats.dump_results ("Total", gsf);

        ACE_Throughput_Stats::dump_throughput ("Total", 
											                         gsf,
                                               test_end - test_start,
                                               stats.samples_count ());
      }

      ACE_DEBUG ((LM_DEBUG, "\n"));
    
      {
        ACE_Sample_History history (n);
        ACE_hrtime_t test_start = ACE_OS::gethrtime ();

        for (j = 0; j != n; ++j)
          {
            CORBA::Any any;
            const char i[] = "1234567890";

            if (insertion == 1)
              {
                ACE_hrtime_t start = ACE_OS::gethrtime ();

                any <<= i;

                ACE_hrtime_t now = ACE_OS::gethrtime ();
                history.sample (now - start);

                const char *o;

                result = any >>= o;
                  }
            else
              {
                any <<= i;

                const char *o;

                ACE_hrtime_t start = ACE_OS::gethrtime ();

                result = any >>= o;

                ACE_hrtime_t now = ACE_OS::gethrtime ();
                history.sample (now - start);
              }
          }

        ACE_hrtime_t test_end = ACE_OS::gethrtime ();

        if (insertion == 1)
          {
            ACE_DEBUG ((LM_DEBUG, 
                        "String insertion test finished\n"));
          }
        else
          {
            ACE_DEBUG ((LM_DEBUG, 
                        "String extraction test finished\n"));
          }

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

        ACE_Basic_Stats stats;
        history.collect_basic_stats (stats);
        stats.dump_results ("Total", gsf);

        ACE_Throughput_Stats::dump_throughput ("Total", 
											                         gsf,
                                               test_end - test_start,
                                               stats.samples_count ());
      }

      ACE_DEBUG ((LM_DEBUG, "\n"));
    
      {
        ACE_Sample_History history (n);
        ACE_hrtime_t test_start = ACE_OS::gethrtime ();

        for (j = 0; j != n; ++j)
          {
            CORBA::Any any;
            const char i[] = "1234567890";
            any <<= i;
            CORBA::Any copy;

            ACE_hrtime_t start = ACE_OS::gethrtime ();

            copy = any;

            ACE_hrtime_t now = ACE_OS::gethrtime ();
            history.sample (now - start);
          }

        ACE_hrtime_t test_end = ACE_OS::gethrtime ();

        ACE_DEBUG ((LM_DEBUG, 
                    "Copy test finished\n"));
        ACE_DEBUG ((LM_DEBUG, 
                    "High resolution timer calibration...."));
        ACE_UINT32 gsf = ACE_High_Res_Timer::global_scale_factor ();
        ACE_DEBUG ((LM_DEBUG, 
                    "done\n"));

        ACE_Basic_Stats stats;
        history.collect_basic_stats (stats);
        stats.dump_results ("Total", gsf);

        ACE_Throughput_Stats::dump_throughput ("Total", 
											                         gsf,
                                               test_end - test_start,
                                               stats.samples_count ());
      }
    }
  ACE_CATCHANY
    {
      ACE_PRINT_EXCEPTION (ACE_ANY_EXCEPTION, "Any performance test");
      return 1;
    }
  ACE_ENDTRY;

  return 0;
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -