Answer the question
In order to leave comments, you need to log in
How to calculate program execution time?
Given a computer with a processor of a certain frequency.
How to calculate how long a program will run on this computer (assuming no other programs will run)?
Answer the question
In order to leave comments, you need to log in
No way to calculate until you have a hard real time OS. Neither Windows nor Linux guarantees you any execution time, therefore all calculations are meaningless.
Take the assembler code of the program, for each command, according to the reference book, determine the number of cycles for which it is executed. Go through the code of the program, determining all the branches and the number of passes of each loop. Sum the cycles of all executed commands, multiply by the execution time of one cycle.
On modern processors with a computational pipeline, calculation is impossible, since the number of cycles per instruction is not uniquely determined.
As I suspect, your task is to assign taken (from the ceiling?) values to various operations, interpret the program and sum up the "costs" of all operations performed.
It is easier to measure with some accuracy than to calculate. Like
Yes, and even then, provided that there are no branches that depend on external factors - for example, waiting for I / O results ...
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question