Mercurial > ~astiob > upreckon > hgweb
diff upreckon/unix.py @ 251:d3a5d1929ad2
Wall-clock time limit is now enforced before handling CPU times on Win32 too
author | Oleg Oshmyan <chortos@inbox.lv> |
---|---|
date | Sun, 19 Jan 2014 01:21:22 +0000 |
parents | acd70a60bc17 |
children |
line wrap: on
line diff
--- a/upreckon/unix.py Sun Jan 19 00:50:27 2014 +0000 +++ b/upreckon/unix.py Sun Jan 19 01:21:22 2014 +0000 @@ -227,19 +227,18 @@ if (case.maxwalltime and case.time_stopped - case.time_started > case.maxwalltime): raise WallTimeLimitExceeded - if new_rusage: + if new_rusage and (case.maxcputime or not case.maxwalltime): time_started = old_rusage.ru_utime + old_rusage.ru_stime + cpustart time_stopped = new_rusage.ru_utime + new_rusage.ru_stime # Yes, this actually happens if time_started > time_stopped: time_started = time_stopped - if case.maxcputime or not case.maxwalltime: - case.time_started = time_started - case.time_stopped = time_stopped - case.time_limit_string = case.cpu_time_limit_string - if (case.maxcputime and - time_stopped - time_started > case.maxcputime): - raise CPUTimeLimitExceeded + case.time_started = time_started + case.time_stopped = time_stopped + case.time_limit_string = case.cpu_time_limit_string + if (case.maxcputime and + time_stopped - time_started > case.maxcputime): + raise CPUTimeLimitExceeded if case.maxmemory: if sys.platform != 'darwin': maxrss = case.maxmemory * 1024