I am starting to write a program that checks a computers response time for certain functions. I don't know if I'm even on the right track with this code. Any suggestions?
#include <iostream.h>
#include <stdlib.h>
#include <conio.h>
#include <time.h>
#include <iomanip.h>
#include <string.h>
class speed
{
public :
double memcheck( void );
double diskcheck( void );
double floatcheck( void );
void sleep( clock_t wait);
private:
};
double speed::memcheck( void )
{
clock_t start, finish;
char arr_string[15] = "Memory Test123";
char* ptr_str = new char;
int i;
double duration = 0;
start = clock();
for (i=10000; i > 0; i--)
{
strcpy(ptr_str, arr_string);
// delete ptr_str;
ptr_str = NULL;
}
finish = clock();
duration = (double)(finish - start) / CLOCKS_PER_SEC;
cout << "This test lasted " << duration << " seconds";
return duration;
}
int main()
{
speed perf;
cout << perf.memcheck();
return 0;
};