I searched everywhere before posting, but couldn’t find an answer..
I need to calculate some statistics (Avg, St. Dev., etc.. ) for the execution time of an algorithm, so i have got this c++ program (bb.exe) that launches the algorithm and outputs the comp time.
Whenever i launch this program from the shell, it takes its time, but works fine.
Since the execution is not really fast, i wrote a c program (CalculateStat) that uses the system() call
system("bb.exe > output.txt");
to execute many times the previous algorithm and then calculates the needed statistics, so i can just launch “./CalculateStat” and come back a few hours later to see the results.
CalculateStat outputs ( in Standard Output ) every line printed by bb.exe.
The problem is that when CalculateStat launches bb.exe, it happens that bb.exe freezes with no reason (freezes about 2 times every 6 computations), so i have to kill it (ctrl+c) to let CalculateStat go on.
At first, i tought it could be a problem from the “system” call, so i wrote a perl script that did pretty much the same things, but i got the same problem.
Anyone has a suggestion?
EDIT–
I tought the problem might be the concurrent access to the output file, so i removed from “CalculateStat” the part reading the file, leaving only the consecutive calls.. But it still freezes
EDIT 2–
Wow.. It just got too weird, so i just kept trying to call the original bb.exe from the terminal, and it froze there too.. Now i know the problem was just the bb freezing randomly, (it never froze during tests, it started freezing on statistics calc.. )
Anyway, there’s no point in this question now.. Sorry everyone 🙁
The problem was actually the Blackbox.. It was freezing when weird parameters were applied, and i solved it by using some checks on the main program. Thanks to everyone!