C
C
Chik-2016-02-10 11:02:55
Programming
Chik-, 2016-02-10 11:02:55

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

4 answer(s)
V
Vladimir Martyanov, 2016-02-10
@vilgeforce

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.

R
Rsa97, 2016-02-10
@Rsa97

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.

M
MiiNiPaa, 2016-02-10
@MiiNiPaa

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.

V
Vladimir Kuts, 2016-02-10
@fox_12

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 question

Ask a Question

731 491 924 answers to any question