For a project I am supposed to measure the running time of basic primitive operations in C++ for the machine that I am using. It says this:
Write a program that determines the values of the timing parameters of (
fetch
,store,
+
,-
,*
,/
,<
, function call, function return,new
,delete
, and[]
) for the machine on which it is run.
fetch
and store
is:
a = b + 1
b
and 1
are being "fetched" (and added together with +
), and stored in a
.
I've never done something like this before. Doing I need to use a clock method to calculate the running time? Should the code that I am timing be complex or simple? How many times should it be evaluated?
I think this might be helpful. Personally I would make some loops with different number of iterations (starting from for example 10 and ending at 100 000). Similar to comparing sorting methods.
Ofc, if you need more complex method you can use performance hook mentioned before.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With