• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ runTest函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: runTest

void SMemFunctionalTests::testGreaterOrEqual()
{
	SoarHelper::setStopPhase(agent, SoarHelper::StopPhase::OUTPUT);
	runTest("testGreaterOrEqual", 1);
}
开发者ID:SoarGroup,项目名称:Soar,代码行数:5,代码来源:SMemFunctionalTests.cpp


示例2: test_BR_LLSC_6_20_010

int test_BR_LLSC_6_20_010(MYKI_BR_ContextData_t *pData)
{
    int rv = TRUE;
    CardImage_t CardImage;

    /*
    **  Test with
    */
    if (CreateCardImage_Empty(&CardImage) < 0)
    {
        return FALSE;
    }
    CreateProduct( &CardImage, 1, PRODUCT_ID_NHOUR, 1, 1, pData->DynamicData.currentDateTime );
    CardImage.pMYKI_TAControl->ProductInUse = 1;

    /*
    ** Setup Transport locations
    **      Not a Border Trip
    */
    pData->DynamicData.transportLocationsCount = 3;

    pData->DynamicData.transportLocations[0].inner_zone = 3;
    pData->DynamicData.transportLocations[0].zone = 3;
    pData->DynamicData.transportLocations[0].outer_zone = 4;

    pData->DynamicData.transportLocations[1].inner_zone = 4;
    pData->DynamicData.transportLocations[1].zone = 4;
    pData->DynamicData.transportLocations[1].outer_zone = 5;

    pData->DynamicData.transportLocations[2].inner_zone = 5;
    pData->DynamicData.transportLocations[2].zone = 6;
    pData->DynamicData.transportLocations[2].outer_zone = 6;

    /*
    **  Run the Test and examine the results
    */
    if (!runTest(pData, RULE_RESULT_EXECUTED, 302))
    {
        return FALSE;
    }

    /*
    ** Examine conditions
    */
    if (pData->DynamicData.transportLocationsCount)
    {
        CsVerbose("test_BR_LLSC_6_20 - transportLocationsCount NOT zero as expected" );
        rv = FALSE;
    }

    if (pData->DynamicData.currentTripZoneLow != 4)
    {
        CsVerbose("test_BR_LLSC_6_20 - currentTripZoneLow NOT as expected. Was:%d",pData->DynamicData.currentTripZoneLow );
        rv = FALSE;
    }

    if (pData->DynamicData.currentTripZoneHigh != 5)
    {
        CsVerbose("test_BR_LLSC_6_20 - currentTripZoneHigh NOT as expected. Was:%d",pData->DynamicData.currentTripZoneHigh );
        rv = FALSE;
    }

    return rv;
}
开发者ID:PengWEI9,项目名称:Vix,代码行数:64,代码来源:test_BR_LLSC_6_20.c


示例3: main


//.........这里部分代码省略.........
  durationMilliSecs = GetDurationMilliSecs(currSysTimeStart, currSysTimeStop) - overHeadMilliSecs;

  printf( "%-45s %15ld %15.3f\n",
	    "Dummy call -> Interlocked with cond x 2",
          durationMilliSecs,
          (float) durationMilliSecs * 1E3 / ITERATIONS);


  TESTSTART
  assert((InterlockedIncrement(&i), 1) == one);
  assert((InterlockedDecrement(&i), 1) == one);
  TESTSTOP

  durationMilliSecs = GetDurationMilliSecs(currSysTimeStart, currSysTimeStop) - overHeadMilliSecs;

  printf( "%-45s %15ld %15.3f\n",
	    "InterlockedOp x 2",
          durationMilliSecs,
          (float) durationMilliSecs * 1E3 / ITERATIONS);


  InitializeCriticalSection(&cs);

  TESTSTART
  assert((EnterCriticalSection(&cs), 1) == one);
  assert((LeaveCriticalSection(&cs), 1) == one);
  TESTSTOP

  DeleteCriticalSection(&cs);

  durationMilliSecs = GetDurationMilliSecs(currSysTimeStart, currSysTimeStop) - overHeadMilliSecs;

  printf( "%-45s %15ld %15.3f\n",
	    "Simple Critical Section",
          durationMilliSecs,
          (float) durationMilliSecs * 1E3 / ITERATIONS);


  old_mutex_use = OLD_WIN32CS;
  assert(old_mutex_init(&ox, NULL) == 0);

  TESTSTART
  assert(old_mutex_lock(&ox) == zero);
  assert(old_mutex_unlock(&ox) == zero);
  TESTSTOP

  assert(old_mutex_destroy(&ox) == 0);

  durationMilliSecs = GetDurationMilliSecs(currSysTimeStart, currSysTimeStop) - overHeadMilliSecs;

  printf( "%-45s %15ld %15.3f\n",
	    "Old PT Mutex using a Critical Section (WNT)",
          durationMilliSecs,
          (float) durationMilliSecs * 1E3 / ITERATIONS);


  old_mutex_use = OLD_WIN32MUTEX;
  assert(old_mutex_init(&ox, NULL) == 0);

  TESTSTART
  assert(old_mutex_lock(&ox) == zero);
  assert(old_mutex_unlock(&ox) == zero);
  TESTSTOP

  assert(old_mutex_destroy(&ox) == 0);

  durationMilliSecs = GetDurationMilliSecs(currSysTimeStart, currSysTimeStop) - overHeadMilliSecs;

  printf( "%-45s %15ld %15.3f\n",
	    "Old PT Mutex using a Win32 Mutex (W9x)",
          durationMilliSecs,
          (float) durationMilliSecs * 1E3 / ITERATIONS);

  printf( ".............................................................................\n");

  /*
   * Now we can start the actual tests
   */
#ifdef PTW32_MUTEX_TYPES
  runTest("PTHREAD_MUTEX_DEFAULT (W9x,WNT)", PTHREAD_MUTEX_DEFAULT);

  runTest("PTHREAD_MUTEX_NORMAL (W9x,WNT)", PTHREAD_MUTEX_NORMAL);

  runTest("PTHREAD_MUTEX_ERRORCHECK (W9x,WNT)", PTHREAD_MUTEX_ERRORCHECK);

  runTest("PTHREAD_MUTEX_RECURSIVE (W9x,WNT)", PTHREAD_MUTEX_RECURSIVE);
#else
  runTest("Non-blocking lock", 0);
#endif

  printf( "=============================================================================\n");

  /*
   * End of tests.
   */

  pthread_mutexattr_destroy(&ma);

  return 0;
}
开发者ID:kasravi,项目名称:MIDIUIUgenVS,代码行数:101,代码来源:benchtest1.c


示例4: TEST

TEST(WTF_Condition, TenProducersTenConsumersHundredSlotsNotifyAll)
{
    runTest(10, 10, 100, 50000, TacticallyNotifyAll);
}
开发者ID:eocanha,项目名称:webkit,代码行数:4,代码来源:Condition.cpp


示例5: test_BR_LLSC_6_20_008

int test_BR_LLSC_6_20_008(MYKI_BR_ContextData_t *pData)
{
    int rv = TRUE;
    CardImage_t CardImage;

    pData->InternalData.TransportMode       = TRANSPORT_MODE_BUS;
    pData->DynamicData.lineId               = 1;
    pData->DynamicData.stopId               = 1;

    /*
    **  Test with
    */

    if ( CreateCardImage_Empty( &CardImage ) < 0 )
    {
        return FALSE;
    }

    CreateProduct( &CardImage, 1, PRODUCT_ID_NHOUR, 1, 1, pData->DynamicData.currentDateTime + 60 );    // Don't care but make it sensible

    CardImage.pMYKI_TAProduct[ 0 ]->LastUsage.DateTime = pData->DynamicData.currentDateTime - 60;       // Don't care but make it sensible
    CardImage.pMYKI_TAProduct[ 0 ]->LastUsage.Location.EntryPointId = 10500;    // Station ID
    CardImage.pMYKI_TAProduct[ 0 ]->LastUsage.Location.RouteId      = 0;        // Not set
    CardImage.pMYKI_TAProduct[ 0 ]->LastUsage.Location.StopId       = 0;        // Not set
    CardImage.pMYKI_TAProduct[ 0 ]->LastUsage.ProviderId            = 0;        // Rail provider
    CardImage.pMYKI_TAProduct[ 0 ]->LastUsage.Zone                  = 0;        // Don't care

    CardImage.pMYKI_TAControl->ProductInUse = 1;

    /*
    ** Setup Transport locations
    **      Not a Border Trip
    */
    pData->DynamicData.transportLocationsCount = 2;

    pData->DynamicData.transportLocations[0].inner_zone = 3;
    pData->DynamicData.transportLocations[0].zone = 3;
    pData->DynamicData.transportLocations[0].outer_zone = 4;

    pData->DynamicData.transportLocations[1].inner_zone = 4;
    pData->DynamicData.transportLocations[1].zone = 4;
    pData->DynamicData.transportLocations[1].outer_zone = 5;

    /*
    ** Forced Scan Off not set (testing scan-on/off modes of transport instead)
    */
     pData->DynamicData.isForcedScanOff = FALSE;

    /*
    **  Run the Test and examine the results
    */
    if (!runTest(pData, RULE_RESULT_EXECUTED, 102))
    {
        return FALSE;
    }

    /*
    ** Examine conditions
    */
    if (pData->DynamicData.transportLocationsCount)
    {
        CsVerbose("test_BR_LLSC_6_20 - transportLocationsCount NOT zero as expected" );
        rv = FALSE;
    }

    if (pData->DynamicData.currentTripZoneLow != 4)
    {
        CsVerbose("test_BR_LLSC_6_20 - currentTripZoneLow NOT as expected. Was:%d",pData->DynamicData.currentTripZoneLow );
        rv = FALSE;
    }

    if (pData->DynamicData.currentTripZoneHigh != 4)
    {
        CsVerbose("test_BR_LLSC_6_20 - currentTripZoneHigh NOT as expected. Was:%d",pData->DynamicData.currentTripZoneHigh );
        rv = FALSE;
    }

    return rv;
}
开发者ID:PengWEI9,项目名称:Vix,代码行数:79,代码来源:test_BR_LLSC_6_20.c


示例6: main

int
main(void){

  srand(NdbTick_CurrentMillisecond());
#if 0
  for(int i = 0; i<100; i++)
    ndbout_c("randRange(0, 3) = %d", randRange(0, 3));
  return 0;
#endif
  SignalSender ss;
  
  ndbout << "Connecting...";
  if(!ss.connect(30)){
    ndbout << "failed" << endl << "Exiting" << endl;
    return 0;
  }
  ndbout << "done" << endl;
  ndbout_c("Connected as block=%d node=%d",
	   refToBlock(ss.getOwnRef()), refToNode(ss.getOwnRef()));
  
  Uint32 data[25];
  Uint32 sec0[70];
  Uint32 sec1[123];
  Uint32 sec2[10];
  
  data[0] = ss.getOwnRef();
  data[1] = 1;
  data[2] = 76; 
  data[3] = 1;
  data[4] = 1;
  data[5] = 70;
  data[6] = 123;
  data[7] = 10;
  const Uint32 theDataLen = 18;

  for(Uint32 i = 0; i<70; i++)
    sec0[i] = i;
  
  for(Uint32 i = 0; i<123; i++)
    sec1[i] = 70+i;

  for(Uint32 i = 0; i<10; i++)
    sec2[i] = (i + 1)*(i + 1);
  
  SimpleSignal signal1;
  signal1.set(ss, 0, CMVMI, GSN_TESTSIG, theDataLen + 2);  
  signal1.header.m_noOfSections = 1;
  signal1.header.m_fragmentInfo = 1;

  memcpy(&signal1.theData[0], data, 4 * theDataLen );
  signal1.theData[theDataLen + 0] = 0;
  signal1.theData[theDataLen + 1] = 7; // FragmentId
  
  signal1.ptr[0].sz = 60;
  signal1.ptr[0].p = &sec0[0];
  
  SimpleSignal signal2;
  
  Uint32 idx = 0;
  memcpy(&signal2.theData[0], data, 4 * theDataLen );
  signal2.theData[theDataLen + idx] = 0; idx++;
  signal2.theData[theDataLen + idx] = 1; idx++;
  //signal2.theData[theDataLen + idx] = 2; idx++;
  signal2.theData[theDataLen + idx] = 7; idx++; // FragmentId

  signal2.set(ss, 0, CMVMI, GSN_TESTSIG, theDataLen + idx);
  signal2.header.m_fragmentInfo = 3;
  signal2.header.m_noOfSections = idx - 1;
  
  signal2.ptr[0].sz = 10;
  signal2.ptr[0].p = &sec0[60];
  
  signal2.ptr[1].sz = 123;
  signal2.ptr[1].p = &sec1[0];
  
  signal2.ptr[2].sz = 10;
  signal2.ptr[2].p = &sec2[0];
  
  char * buf;
  while((buf = readline("Enter command: "))){
    add_history(buf);
    data[1] = atoi(buf);
    if(strcmp(buf, "r") == 0){
      SimpleSignal * ret1 = ss.waitFor();
      (* ret1).print();
      delete ret1;
      continue;
    }
    if(strcmp(buf, "a") == 0){
      runTest(ss, 10, true);
      print_help();
      continue;
    }
    if(strcmp(buf, "b") == 0){
      runTest(ss, 100, false);
      print_help();
      continue;
    }
    if(strcmp(buf, "c") == 0){
      runTest(ss, 1000000, false);
//.........这里部分代码省略.........
开发者ID:4T-Shirt,项目名称:mysql,代码行数:101,代码来源:testLongSig.cpp


示例7: main

int main(int argc, const char * argv[])
{
    printf("XPC Tests-c ");
    
#ifdef _WIN32
    printf("(Windows)\n");
#elif (__APPLE__)
    printf("(Mac) \n");
#elif (__linux)
    printf("(Linux) \n");
#else
	printf("(Unable to determine operating system) \n")
#endif
    
	// Basic Networking
	runTest(testOpen, "open");
	runTest(testClose, "close");
	// Datarefs
	runTest(testGETD_Basic, "GETD");
	runTest(testGETD_Types, "GETD (types)");
	runTest(testGETD_TestFloat, "GETD (test float)");
	runTest(testDREF, "DREF");
	// Pause
	runTest(testSIMU_Basic, "SIMU");
	runTest(testSIMU_Toggle, "SIMU (toggle)");
	// CTRL
	runTest(testCTRL_Player, "CTRL (player)");
	runTest(testCTRL_NonPlayer, "CTRL (non-player)");
	runTest(testCTRL_Speedbrakes, "CTRL (speedbrakes)");
	// POSI
	runTest(testPOSI_Player, "POSI (player)");
	runTest(testPOSI_NonPlayer, "POSI (non-player)");
	// Data
	runTest(testDATA, "DATA");
	// Text
	runTest(testTEXT, "TEXT");
	// Waypoints
	runTest(testWYPT, "WYPT");
	// View
	runTest(testView, "VIEW");
	// setConn
	runTest(testCONN, "CONN");
    
    printf( "----------------\nTest Summary\n\tFailed: %i\n\tPassed: %i\n", testFailed, testPassed );
	printf("Press any key to exit.");
	getchar();
    
    return 0;
}
开发者ID:jordanbudi,项目名称:XPlaneConnect,代码行数:49,代码来源:main.c


示例8: main

int
main (int argc, char *argv[])
{
  pthread_mutexattr_init(&ma);

  printf( "=============================================================================\n");
  printf( "Trylock plus unlock on an unlocked mutex.\n");
  printf( "%ld iterations.\n\n", ITERATIONS);
  printf( "%-45s %15s %15s\n",
	    "Test",
	    "Total(msec)",
	    "average(usec)");
  printf( "-----------------------------------------------------------------------------\n");

  /*
   * Time the loop overhead so we can subtract it from the actual test times.
   */

  TESTSTART
  TESTSTOP

  durationMilliSecs = GetDurationMilliSecs(currSysTimeStart, currSysTimeStop) - overHeadMilliSecs;
  overHeadMilliSecs = durationMilliSecs;

  old_mutex_use = OLD_WIN32CS;
  assert(old_mutex_init(&ox, NULL) == 0);
  TESTSTART
  (void) old_mutex_trylock(&ox);
  (void) old_mutex_unlock(&ox);
  TESTSTOP
  assert(old_mutex_destroy(&ox) == 0);
  durationMilliSecs = GetDurationMilliSecs(currSysTimeStart, currSysTimeStop) - overHeadMilliSecs;
  printf( "%-45s %15ld %15.3f\n",
	    "Old PT Mutex using a Critical Section (WNT)",
          durationMilliSecs,
          (float) durationMilliSecs * 1E3 / ITERATIONS);

  old_mutex_use = OLD_WIN32MUTEX;
  assert(old_mutex_init(&ox, NULL) == 0);
  TESTSTART
  (void) old_mutex_trylock(&ox);
  (void) old_mutex_unlock(&ox);
  TESTSTOP
  assert(old_mutex_destroy(&ox) == 0);
  durationMilliSecs = GetDurationMilliSecs(currSysTimeStart, currSysTimeStop) - overHeadMilliSecs;
  printf( "%-45s %15ld %15.3f\n",
	    "Old PT Mutex using a Win32 Mutex (W9x)",
          durationMilliSecs,
          (float) durationMilliSecs * 1E3 / ITERATIONS);

  printf( ".............................................................................\n");

  /*
   * Now we can start the actual tests
   */
#ifdef  __PTW32_MUTEX_TYPES
  runTest("PTHREAD_MUTEX_DEFAULT", PTHREAD_MUTEX_DEFAULT);

  runTest("PTHREAD_MUTEX_NORMAL", PTHREAD_MUTEX_NORMAL);

  runTest("PTHREAD_MUTEX_ERRORCHECK", PTHREAD_MUTEX_ERRORCHECK);

  runTest("PTHREAD_MUTEX_RECURSIVE", PTHREAD_MUTEX_RECURSIVE);
#else
  runTest("Non-blocking lock", 0);
#endif

  printf( ".............................................................................\n");

  pthread_mutexattr_setrobust(&ma, PTHREAD_MUTEX_ROBUST);

#ifdef  __PTW32_MUTEX_TYPES
  runTest("PTHREAD_MUTEX_DEFAULT (Robust)", PTHREAD_MUTEX_DEFAULT);

  runTest("PTHREAD_MUTEX_NORMAL (Robust)", PTHREAD_MUTEX_NORMAL);

  runTest("PTHREAD_MUTEX_ERRORCHECK (Robust)", PTHREAD_MUTEX_ERRORCHECK);

  runTest("PTHREAD_MUTEX_RECURSIVE (Robust)", PTHREAD_MUTEX_RECURSIVE);
#else
  runTest("Non-blocking lock", 0);
#endif

  printf( "=============================================================================\n");

  /*
   * End of tests.
   */

  pthread_mutexattr_destroy(&ma);

  return 0;
}
开发者ID:BrianGladman,项目名称:pthreads,代码行数:93,代码来源:benchtest4.c


示例9: test_BR_LLSC_6_20_009

int test_BR_LLSC_6_20_009(MYKI_BR_ContextData_t *pData)
{
    int rv = TRUE;
    CardImage_t CardImage;
    MYKI_CD_DifferentialPricing_t differentialPricing;

    /*
    **  Test with
    */
    if (CreateCardImage_Empty(&CardImage) < 0)
    {
        return FALSE;
    }
    CreateProduct( &CardImage, 1, PRODUCT_ID_NHOUR, 1, 1, pData->DynamicData.currentDateTime );
    CardImage.pMYKI_TAControl->ProductInUse = 1;

    /*
    ** Setup Transport locations
    **      Not a Border Trip
    */
    pData->DynamicData.transportLocationsCount = 2;

    pData->DynamicData.transportLocations[0].inner_zone = 3;
    pData->DynamicData.transportLocations[0].zone = 3;
    pData->DynamicData.transportLocations[0].outer_zone = 4;

    pData->DynamicData.transportLocations[1].inner_zone = 4;
    pData->DynamicData.transportLocations[1].zone = 4;
    pData->DynamicData.transportLocations[1].outer_zone = 5;

    /*
    ** Setup a Differential Price to be processed by the Rule
    */
    differentialPricing.discount_type = MYKI_CD_DISCOUNT_TYPE_PERCENT;
    differentialPricing.applied_discount = 33;
    strcpy(differentialPricing.short_desc,"Test 008");

    MYKI_CD_setDifferentialPriceStructure(&differentialPricing);

    /*
    **  Run the Test and examine the results
    */
    if (!runTest(pData, RULE_RESULT_EXECUTED, 202))
    {
        return FALSE;
    }

    /*
    ** Examine conditions
    */
    if (pData->DynamicData.transportLocationsCount)
    {
        CsVerbose("test_BR_LLSC_6_20 - transportLocationsCount NOT zero as expected" );
        rv = FALSE;
    }

    if (pData->DynamicData.currentTripZoneLow != 4)
    {
        CsVerbose("test_BR_LLSC_6_20 - currentTripZoneLow NOT as expected. Was:%d",pData->DynamicData.currentTripZoneLow );
        rv = FALSE;
    }

    if (pData->DynamicData.currentTripZoneHigh != 4)
    {
        CsVerbose("test_BR_LLSC_6_20 - currentTripZoneHigh NOT as expected. Was:%d",pData->DynamicData.currentTripZoneHigh );
        rv = FALSE;
    }

    if (pData->DynamicData.offPeakDiscountRate != 33)
    {
        CsVerbose("test_BR_LLSC_6_20 - offPeakDiscountRate NOT as expected" );
        rv = FALSE;
    }

    if (pData->DynamicData.isOffPeak != TRUE)
    {
        CsVerbose("test_BR_LLSC_6_20 - isOffPeak NOT as expected" );
        rv = FALSE;
    }

    return rv;
}
开发者ID:PengWEI9,项目名称:Vix,代码行数:82,代码来源:test_BR_LLSC_6_20.c


示例10: main

int main (int argc, char** argv) {
    if(argc < 4) {
        std::cout << "3 command line arguments are needed.\nPlease execute with ./hw0 <input_filename> <process #> <number of match list>\n";
        return 0;
    }
    FILE* fPtr; //file pointer to file to be parsed
    char *line; //line to parse file line by line

    fPtr = fopen(argv[1], "r");
    int total_rows = 0;
    line = (char*)malloc(sizeof(char)*LINE_MAX);
    VectorsMap points;
    Parser fileParser;
    //vectors that will be generated for the runs.
    std::vector<std::vector<float>> generated_vectors(30);

    //parse the file line by line
    while(fgets(line, LINE_MAX, fPtr)) {
        //make sure that we do not read an empty line
        if(line[0] != '\0') {
            //send the line to be further parsed
            points.push_back(fileParser.parseLine(line));
            //increment total rows count
            total_rows++;
        }
    }
    free(line);
    fclose(fPtr);

    srand(34122);
    int i,j, process_count=atoi(argv[2]), num_max=atoi(argv[3]), size=0;
    //the size of the search vectors
    int sizes[] = {9,11,17,29};
    int sizes_count = 4;
    //will hold the offsets for each process
    std::vector<segment> segments(process_count);

    //initialize shared memory
    size_t memory_space = process_count*4*num_max;
    float shm_size = memory_space * sizeof(float);
    int shmId;
    // use current time as seed for random generator
    std::srand(std::time(0));
    key_t shmKey = std::rand();
    int shmFlag = IPC_CREAT | 0666;
    float * shm;

    /* Initialize shared memory */
    if((shmId = shmget(shmKey, shm_size, shmFlag)) < 0)
    {
        std::cerr << "Init: Failed to initialize shared memory (" << shmId << ")" << std::endl;
        exit(1);
    }

    if((shm = (float *)shmat(shmId, NULL, 0)) == (float *) -1)
    {
        std::cerr << "Init: Failed to attach shared memory (" << shmId << ")" << std::endl;
        exit(1);
    }
    //get number of items for each process in shared memory
    const unsigned int per_procc_mem = num_max*4;
    //initialize offsets
    for(i=0; i< process_count; i++) {
        //get segments for dataset
        int size = total_rows/process_count;
        segments.at(i).start = size*i;
        segments.at(i).end = size*i + size;

        //get segments for shared memory location segment for each process
        segments.at(i).shm_start = i*per_procc_mem;
        segments.at(i).shm_end = i*per_procc_mem + per_procc_mem;

        //if at the last process, check to see if the division is not even
        if(i==process_count-1)
            segments.at(i).end += total_rows%process_count;
    }

    //create the final results vector
    //reserve enough space to be able to merge all of our processes' stuff
    std::vector<ResultType> final_results;
    std::vector<float> copy;
    final_results.reserve(process_count*num_max);

    //create start and end chrono time points
    std::chrono::time_point<std::chrono::system_clock> start, end;
    std::map<int, double> times;

    //loop through the 4 different sizes of vectors
    for(i=0; i<sizes_count; i++) {


        std::cout << "\n\n==============TEST BEGIN==================\n" << std::endl;
        //run the test:
        copy = generateScottVector(sizes[i]);
        final_results = circularSubvectorMatch(sizes[i], &copy, &points, num_max, 0, total_rows, 0, 0, NULL, true);
        copy.clear();
        //run the test
        if(runTest(sizes[i], &final_results, num_max)) {
            std::cout << "Test was SUCCESSFUL against vector: \n" << std::endl;
            std::cout << scottgs::vectorToCSV(generateScottVector(sizes[i])) << "\n\n" << std::endl;
//.........这里部分代码省略.........
开发者ID:GeorgiAngelov,项目名称:School-Projects,代码行数:101,代码来源:hw2.cpp


示例11: main


//.........这里部分代码省略.........
  assert(pthread_create(&worker, NULL, CSThread, NULL) == 0);
  TESTSTART
  LeaveCriticalSection(&cs1);
  sched_yield();
  LeaveCriticalSection(&cs2);
  EnterCriticalSection(&cs1);
  EnterCriticalSection(&cs2);
  TESTSTOP
  running = 0;
  LeaveCriticalSection(&cs2);
  LeaveCriticalSection(&cs1);
  assert(pthread_join(worker, NULL) == 0);
  DeleteCriticalSection(&cs2);
  DeleteCriticalSection(&cs1);
  durationMilliSecs = GetDurationMilliSecs(currSysTimeStart, currSysTimeStop) - overHeadMilliSecs;
  printf( "%-45s %15ld %15.3f\n",
	    "Simple Critical Section",
          durationMilliSecs,
          (float) durationMilliSecs * 1E3 / ITERATIONS / 4 );


  old_mutex_use = OLD_WIN32CS;
  assert(old_mutex_init(&ox1, NULL) == 0);
  assert(old_mutex_init(&ox2, NULL) == 0);
  assert(old_mutex_lock(&ox1) == 0);
  assert(old_mutex_lock(&ox2) == 0);
  running = 1;
  assert(pthread_create(&worker, NULL, oldThread, NULL) == 0);
  TESTSTART
  (void) old_mutex_unlock(&ox1);
  sched_yield();
  (void) old_mutex_unlock(&ox2);
  (void) old_mutex_lock(&ox1);
  (void) old_mutex_lock(&ox2);
  TESTSTOP
  running = 0;
  assert(old_mutex_unlock(&ox1) == 0);
  assert(old_mutex_unlock(&ox2) == 0);
  assert(pthread_join(worker, NULL) == 0);
  assert(old_mutex_destroy(&ox2) == 0);
  assert(old_mutex_destroy(&ox1) == 0);
  durationMilliSecs = GetDurationMilliSecs(currSysTimeStart, currSysTimeStop) - overHeadMilliSecs;
  printf( "%-45s %15ld %15.3f\n",
	    "Old PT Mutex using a Critical Section (WNT)",
          durationMilliSecs,
          (float) durationMilliSecs * 1E3 / ITERATIONS / 4);


  old_mutex_use = OLD_WIN32MUTEX;
  assert(old_mutex_init(&ox1, NULL) == 0);
  assert(old_mutex_init(&ox2, NULL) == 0);
  assert(old_mutex_lock(&ox1) == 0);
  assert(old_mutex_lock(&ox2) == 0);
  running = 1;
  assert(pthread_create(&worker, NULL, oldThread, NULL) == 0);
  TESTSTART
  (void) old_mutex_unlock(&ox1);
  sched_yield();
  (void) old_mutex_unlock(&ox2);
  (void) old_mutex_lock(&ox1);
  (void) old_mutex_lock(&ox2);
  TESTSTOP
  running = 0;
  assert(old_mutex_unlock(&ox1) == 0);
  assert(old_mutex_unlock(&ox2) == 0);
  assert(pthread_join(worker, NULL) == 0);
  assert(old_mutex_destroy(&ox2) == 0);
  assert(old_mutex_destroy(&ox1) == 0);
  durationMilliSecs = GetDurationMilliSecs(currSysTimeStart, currSysTimeStop) - overHeadMilliSecs;
  printf( "%-45s %15ld %15.3f\n",
	    "Old PT Mutex using a Win32 Mutex (W9x)",
          durationMilliSecs,
          (float) durationMilliSecs * 1E3 / ITERATIONS / 4);

  printf( ".............................................................................\n");

  /*
   * Now we can start the actual tests
   */
#ifdef PTW32_MUTEX_TYPES
  runTest("PTHREAD_MUTEX_DEFAULT (W9x,WNT)", PTHREAD_MUTEX_DEFAULT);

  runTest("PTHREAD_MUTEX_NORMAL (W9x,WNT)", PTHREAD_MUTEX_NORMAL);

  runTest("PTHREAD_MUTEX_ERRORCHECK (W9x,WNT)", PTHREAD_MUTEX_ERRORCHECK);

  runTest("PTHREAD_MUTEX_RECURSIVE (W9x,WNT)", PTHREAD_MUTEX_RECURSIVE);
#else
  runTest("Blocking locks", 0);
#endif

  printf( "=============================================================================\n");
  /*
   * End of tests.
   */

  pthread_mutexattr_destroy(&ma);

  return 0;
}
开发者ID:Schiiiiins,项目名称:lcu1,代码行数:101,代码来源:benchtest2.c



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ runTests函数代码示例发布时间:2022-05-30
下一篇:
C++ runScript函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap