mirror of
https://github.com/QingdaoU/Judger.git
synced 2024-12-28 16:01:41 +00:00
only calculate user space cpu time
This commit is contained in:
parent
9fd357a5ed
commit
9826ecc678
@ -96,9 +96,7 @@ void run(struct config *_config, struct result *_result) {
|
||||
|
||||
_result->exit_code = WEXITSTATUS(status);
|
||||
_result->cpu_time = (int) (resource_usage.ru_utime.tv_sec * 1000 +
|
||||
resource_usage.ru_utime.tv_usec / 1000 +
|
||||
resource_usage.ru_stime.tv_sec * 1000 +
|
||||
resource_usage.ru_stime.tv_usec / 1000);
|
||||
resource_usage.ru_utime.tv_usec / 1000);
|
||||
_result->memory = resource_usage.ru_maxrss * 1024;
|
||||
|
||||
// get end time
|
||||
|
@ -260,13 +260,12 @@ class IntegrationTest(base.BaseTestCase):
|
||||
|
||||
def test_gcc_random(self):
|
||||
config = self.base_config
|
||||
config["max_memory"] = _judger.UNLIMITED
|
||||
config["exe_path"] = "/usr/bin/gcc"
|
||||
config["args"] = ["../test_src/integration/gcc_random.c",
|
||||
"-o", os.path.join(self.workspace, "gcc_random")]
|
||||
result = _judger.run(**config)
|
||||
self.assertEqual(result["result"], _judger.RESULT_CPU_TIME_LIMIT_EXCEEDED)
|
||||
self.assertTrue(result["cpu_time"] >= 1950)
|
||||
self.assertTrue(result["real_time"] >= 1950)
|
||||
self.assertTrue(result["real_time"] >= 2000)
|
||||
|
||||
def test_cpp_meta(self):
|
||||
config = self.base_config
|
||||
@ -276,8 +275,8 @@ class IntegrationTest(base.BaseTestCase):
|
||||
"-o", os.path.join(self.workspace, "cpp_meta")]
|
||||
result = _judger.run(**config)
|
||||
self.assertEqual(result["result"], _judger.RESULT_CPU_TIME_LIMIT_EXCEEDED)
|
||||
self.assertTrue(result["cpu_time"] >= 1950)
|
||||
self.assertTrue(result["real_time"] >= 1950)
|
||||
self.assertTrue(result["cpu_time"] > 1500)
|
||||
self.assertTrue(result["real_time"] >= 2000)
|
||||
|
||||
def test_output_size(self):
|
||||
config = self.base_config
|
||||
|
Loading…
Reference in New Issue
Block a user