January 23rd, 2013, 06:00 PM
fwrite calculating elapsed Time
I have a question.
I would like to actually have some measure of roughly how long it takes to do a fwrite to a drive.
when i do the following:
clock_t begin = clock();
unsigned long long size_t = fwrite(send, 1, transfer_size*sizeof(unsigned long long), wpFile);
clock_t end = clock();
double long elapsed_secs = double long(end - begin) / CLOCKS_PER_SEC;
Unfortunately, I don't get any different result for different transfer size!!!
My guess is that the clock_t , once it issues a fwrite command, some how stops its measurement, and it comes back again, when I am already done with fwrite.
I do get the almost same measure, whether my transfer size is 32KB Byte or 16MB !
Which I was indeed expecting to see a huge difference.
I wouldn't really want the exact real timing measure (well off course it will be nice to know); and all I care about is to see some difference in time whether I am doing KB transfer vs MB transfer.
Does any one know of any other function that will give me some rough measurement of the actual time being elapsed for fwrite function?
I would really appreciate some help here.
Click Here to Expand Forum to Full Width
This is a CodeGuru survey question.