Please can somebody help me ..........
I have no idea on how to implemenet a program to benchmark functions such as insertion , deletion and iteration and deuqe.
I know that I have to use the clock_t function but I can not figure out, if I need to call the clock_t function inside the functions to be tested.

Thank you

what complier are you using
In VC6.0 you get profiling option in built

The compiler I am using Visual Studio 2005.
Actually I have some problems with the clock funcion, Allways return 0, I am wondering if there is another way to measure the time.

check this out :

class xyx
{
public:
vector<int> intlist;
clock_t start_time,elapsed;
double elapsed_time;
int i,intN;
vect():start_time(0),elapsed(0),elapsed_time(0),i(0),intN(0)
{
}


void insert_Begin()
{
intN = rand();
start_time = clock();
cout<<clock()<<endl;



intlist.insert(intlist.begin(),rand());
cout<<intlist.front()<<endl;
cout<<clock()<<endl;
elapsed = clock()- start_time;
elapsed_time = elapsed / ((double) CLOCKS_PER_SEC);
cout<<"\n\n";



printf("Time elapsed after a New element was inserted at the biginning: %f\n",elapsed_time);
}


void insert_End()
{
intN = rand();
start_time = clock();



intlist.insert(intlist.end(),rand());
cout<<intlist.back()<<endl;
elapsed = clock()- start_time;
elapsed_time = elapsed / ((double) CLOCKS_PER_SEC);
cout<<"\n\n";


printf("Time elapsed after a New element was inserted at the End: %f\n",elapsed_time);


}
}

Hello,

Actually, look into a "profiler" on your system. Profilers are designed to measure code execution times, and help identify where you need to optimize your code. The profiler design also takes account how much CPU the profiler code consumes,

Check out profilers.

Christian

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.