I wanted to calcualte the execution time of Bubble sort or for that matter any loop . i tried using the clock funtion in c but it gives me 0 seconds for even 10000 elemnts being in the list :sad: .

unless you're running a prehistoric computer, 10000 is nothing :) you want to be thinking in terms of millions if you wish to obtain a calculatable time difference.

unless you're running a prehistoric computer, 10000 is nothing :) you want to be thinking in terms of millions if you wish to obtain a calculatable time difference.

But when i include a printf statement in the code the execution time inc to like .4 sec and i guess printf doest take a lot of processing :|

>i guess printf doest take a lot of processing :|
printf doesn't do much internal processing, despite the length of the code for it. ;) The performance hits come from writing to an external device, which is extremely slow when compared to the simple internal data movement of a sort.

but isnt the clock is supposed to be processor clock and i think it doesnt take into account the interupts for other device into account :|

correct me if i am wrong ..... i am new to this :)

ooppss... almost forgot to say thnx to all those who replied :cheesy:

>but isnt the clock is supposed to be processor clock and i think
>it doesnt take into account the interupts for other device into account :|
The processor doesn't stop ticking just because you call an interrupt for a device.

>i meant that clock function only count processor clocks :|
And what do you think the processor is doing while the device is doing its thing?

This article has been dead for over six months. Start a new discussion instead.