BlueBear icon

benchmark.cpp

BlueBear | PRO | 02/09/12 01:54:25 PM UTC | 0 ⭐ | 442 👁️ | Never ⏰ | []
C++ |

1.55 KB

|

None

|

0 👍

/

0 👎

#define MAX 1000000
#include <windows.h>
#include <string.h>
#include <stdio.h>
#include "md5.h"
#include <stdlib.h>                                                         //itoa
#include <assert.h>                                                         //pre assert
#include <time.h>                                                           //pre stopky
using namespace std;
 
DWORD WINAPI Task1(LPVOID)                                                  //thread prvy
{
    printf("process nr 1. is starting...\n");
    MD5 md5 ;
    long int p;                             
        char buffer[33];                                                    //buffer pre 32 bitov
    for(p=0;p<MAX;p++){
        itoa(p,buffer,10);                                                  //transformacia intu na string
          md5.digestString(buffer);                                         //premena na md5
    };
    return 0;
}
 
DWORD WINAPI Task2(LPVOID)  //thread druhy
{
    printf("process nr 2. is starting...\n");
    MD5 md5 ;
    long int p;                                 
        char buffer[33];                                                    //buffer pre 32 bitov
    for(p=0;p<MAX;p++){
        itoa(p,buffer,10);                                                  //transformacia intu na string
          md5.digestString(buffer);                                         //premena na md5
    };
    return 0;
}
 
int main()                                                                  //funkcia main
{
    HANDLE hThread1, hThread2;
    DWORD dwGenericThread; 
   printf("Program is running please be patient...\n");
        clock_t start, stop;                        
        double t = 0.0;                             
        assert((start = clock())!=-1);              
 
    hThread1 = CreateThread(NULL,0,Feladat1,NULL,0,&dwGenericThread); 
    hThread2 = CreateThread(NULL,0,Feladat2,NULL,0,&dwGenericThread); 
    WaitForSingleObject(hThread2,INFINITE);
   
    stop = clock();                             
        t = (double) (stop-start)/CLOCKS_PER_SEC;   
        printf("Runtime: %f\n", t);
        
        getchar();
    return 0;
}

Comments

  •  icon
    01/01/70 12:00:00 AM UTC
    Plain Text |

    0 B

    |

    👍

    /

    👎

    
        
  • Syutrsz icon
    03/31/26 11:02:24 PM UTC
    text |

    0 B

    |

    0 👍

    /

    0 👎

    Best t33n active cpx link daily updates!
     Copy and paste the link in a new browser tab and then hit enter!
     https://crazyporn.@xxx/members/157354/?asgtbndr=1&play=true&spon=adworld&zone=400
     Remove the @ 
  •  icon
    01/01/70 12:00:00 AM UTC
    Plain Text |

    0 B

    |

    👍

    /

    👎