Monday, 15 February 2010

process - What are some factors that could affect program runtime? -



process - What are some factors that could affect program runtime? -

i'm doing work on profiling behavior of programs. 1 thing amount of time process has run on cpu. accomplishing reading sum_exec_runtime field in linux kernel's sched_entity info structure.

after testing simple programs execute loop , exit, running peculiar issue, beingness programme not finish same runtime each time executed. seeing sum_exec_runtime value represented in nanoseconds, expect value differ within few microseconds. however, seeing variations of several milliseconds.

my initial reaction due i/o waiting times, understanding process should give cpu while waiting i/o. furthermore, test programs executing loops, there should little no i/o.

i seeking advice on following:

is sum_exec_runtime not actual time process has had command of cpu? does process not give cpu while waiting i/o? are there other factors impact actual runtime of process (besides i/o)?

keep in mind, trying find actual time process spent executing on cpu. not care total execution time including sleeping or waiting run.

edit: want create clear there no branches in test programme aside loop, loops constant number of iterations.

thanks.

your question broad, can incur context switches various reasons. calling scheme calls involves @ to the lowest degree 1 context switch. page faults cause contexts switches. exceeding time piece causes context switch.

sum_exec_runtime equal ot utime + stime /proc/$pid/stat, sum_exec_runtime measured in nanoseconds. sounds care utime. see proc(5) more details.

you can @ nr_switches both voluntary , involuntary part of sched_entity. business relationship variation, not expect successive runs identical. exact time each run affected of other processes running on system.

you'll affected amount of file scheme cache used on scheme , how many file scheme cache hits in successive runs if doing io @ all.

to give concrete , obvious illustration of how other processes can impact run time of current process, think if exceeding physical ram constraints. if programme asks more ram, kernel going spend more time swapping. time swapping accounted in stime vary depending on how much ram need , how much ram available. there lot's of other ways other processes can impact process's run time. 1 example.

to reply 3 points:

sum_exec_runtime actual time scheduler ran process including scheme time if count switching kernel process giving cpu, yes, not mean different user process may cpu 1 time kernel done. i think i've answered question there lot's of factors.

process linux-kernel profiling scheduling

No comments:

Post a Comment