diff --git a/new_problem b/new_problem --- a/new_problem +++ b/new_problem @@ -21,6 +21,11 @@ end end + +puts "This script is out of dated, shall be fixed soon" +puts "Right now, you can create raw_ev and import" +exit(0) + GRADER_DIR = File.dirname(__FILE__) # print usage @@ -58,7 +63,7 @@ # generating all_tests.cfg puts "generating testcase config file" -template = File.open(File.dirname(__FILE__) + "/all_tests.cfg.erb").read +template = File.open(File.dirname(__FILE__) + "/templates/all_tests.cfg.erb").read all_test_cfg = ERB.new(template) cfg_file = File.open("#{problem}/test_cases/all_tests.cfg","w") diff --git a/std-script/box.cc b/std-script/box.cc --- a/std-script/box.cc +++ b/std-script/box.cc @@ -44,6 +44,7 @@ static volatile int timer_tick; static time_t start_time; static int ticks_per_sec; +static int page_size; #if defined(__GLIBC__) && __GLIBC__ == 2 && __GLIBC_MINOR__ > 0 /* glibc 2.1 or newer -> has lseek64 */ @@ -384,9 +385,11 @@ //printf("%s\n",line); int m; - if(sscanf(line,"%d",&m)==1) + if(sscanf(line,"%d",&m)==1) { + m = (m*page_size+1023)/1024; if(m>max_mem_used) max_mem_used = m; + } fclose(fp); } @@ -404,6 +407,7 @@ sigaction(SIGINT, &sa, NULL); start_time = time(NULL); ticks_per_sec = sysconf(_SC_CLK_TCK); + page_size = getpagesize(); if (ticks_per_sec <= 0) die("Invalid ticks_per_sec!");