示例#1
0
int main() {

  std::cout << bits(0) << " "  << bits(1) << " "<< bits(2) << " "<< bits(-31) << " " << bits(32) << std::endl;

  testIt();
  compare(ms,ms2,msf);
  compare(bb<float>,bb2<float>,bbf<float>);
  compare(bb<float>,bb2<float>,bbf2<float>);
  compare(bb<double>,bb2<double>,bbf<double>);

  return 0;
}
示例#2
0
int main(int argc, char* argv[])
{
   bool aflg = false;   // All base classes flag
   bool rflg = false;   // Random flag
   bool sflg = false;   // TableStoreage flag
   bool tflg = false;   // Timing flag

   // default configuration filename
   const char* configFilename = "test1.edl";

   // Parse arguments
   for (int i = 1; i < argc; i++) {
      if (std::strcmp(argv[i],"-f") == 0) {
         configFilename = argv[++i];
      }
      else if (std::strcmp(argv[i],"-a") == 0) {
         aflg = true;
      }
      else if (std::strcmp(argv[i],"-r") == 0) {
         rflg = true;
      }
      else if (std::strcmp(argv[i],"-s") == 0) {
         sflg = true;
      }
      else if (std::strcmp(argv[i],"-t") == 0) {
         tflg = true;
      }
   }

   // build table
   const Basic::Table* table = builder(configFilename);

   // ---
   // Serialize the table to the output stream
   // ---
   if (!tflg) table->serialize(std::cout);

   // ---
   // Cast table pointers
   // ---
   const Basic::Table1* t1 = dynamic_cast<const Basic::Table1*>(table);
   const Basic::Table2* t2 = dynamic_cast<const Basic::Table2*>(table);
   const Basic::Table3* t3 = dynamic_cast<const Basic::Table3*>(table);
   const Basic::Table4* t4 = dynamic_cast<const Basic::Table4*>(table);

   // ---
   // Call the test function for this LFI table type
   // ---
   double startTime = getComputerTime();
   unsigned int cnt = 0;
   unsigned int n = 1;
   if (tflg) n = TIMING_LOOPS;
   for (unsigned int i = 0; i < n; i++) {
      if (t1 != nullptr && (aflg || t2 == nullptr) ) {
         cnt += testIt(t1, tflg, sflg, rflg);
      }
      if (t2 != nullptr && (aflg || t3 == nullptr) ) {
         cnt += testIt(t2, tflg, sflg, rflg);
      }
      if (t3 != nullptr && (aflg || t4 == nullptr) ) {
         cnt += testIt(t3, tflg, sflg, rflg);
      }
      if (t4 != nullptr) {
         cnt += testIt(t4, tflg, sflg, rflg);
      }
   }

   // ---
   // Timing data
   // ---
   if (tflg) {
      double endTime = Eaagles::getComputerTime();
      double deltaTime = endTime - startTime;
      double perFrameTime = deltaTime/static_cast<double>(TIMING_LOOPS);
      std::cout << "Total Time = " << deltaTime << " for " << TIMING_LOOPS << " frames." << std::endl;
      std::cout << "Ave time per frame (uS) = " << perFrameTime*1000000.0 << std::endl;
      if (cnt > 0) {
         double perCallTime = deltaTime/static_cast<double>(cnt);
         std::cout << "Ave time per call (uS) = " << perCallTime*1000000.0 << std::endl;
      }
   }

   return EXIT_SUCCESS;
}