Mailing List Archive


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[tlug] Giving a program priority briefly



I'm refactoring a carefully optimized C++ program, trying to make sure I
don't slow it down. It has a stdin interface and a benchmark command can
be sent. I'm sending the benchmark command three times, which in total
takes about 5 seconds.

I found it ran notably faster when I became root and used nice as follows:
  cat commands.txt | nice -n -20 ./myprog

I know I got the -20 bit right as my music froze up, as did the console,
for those 5 seconds.

My question/problem is that the three benchmarks often give different
timings, and the timings vary between runs. It seems roughly related to
system load. When "w" tells me system load is higher the benchmark runs
slightly slower. (And the variation between the three benchmarks of a
single run is less than between runs under different system load.)

Would "single user mode" give me full speed? Is there a way to move a
system into that mode, run the test, then move back into my gnome
desktop with all applications still open, with the flick of a switch?

Any other suggestions? I wondered about emulators that count clock
cycles, but would fail to take into account CPU cache wouldn't they?

Darren


-- 
Darren Cook
http://dcook.org/mlsn/ (English-Japanese-German-Chinese free dictionary)
http://dcook.org/work/ (About me and my work)
http://dcook.org/work/charts/  (My flash charting demos)


Home | Main Index | Thread Index

Home Page Mailing List Linux and Japan TLUG Members Links