calculate file operation timig
calculate file operation timig
Hi,
I am trying to calculate the file open time and read,write etc.. time but not able to get. my aim is.. suppose i create or open a file in window. i want to know how much time take to these opearation. i am using clock() function but its showing zero. can anybody help me... which API shall i use..
regards
Om Prakasah
13 Dec 06, 7:19AM
Different computers and operating systems vary wildly in how they keep track of processor time. It's common for the internal processor clock to have a resolution somewhere between hundredths and millionths of a second.
As such its possible that the time to open a file is faster that what clock measures.
To get a better average I suggest:
[list:0507a6cee9]
- create 100 files (perhaps write a program to do this)
- take a time measurement with clock()
- open all 100 files (I think you can do this, so Op have a limit on the number of file handles you can have open)
- take final time measurement.
- calculate time and output.
Either way, I would expect the fopen/fclose (or whatever you're using) to be quick, since its merely checking for the existance of the file.
Login