Description:
[grader] obsolete new_problem, fixed memory measurement bug in box.cc
git-svn-id: http://theory.cpe.ku.ac.th/grader/judge/trunk/scripts@186 6386c4cd-e34a-4fa8-8920-d93eb39b512e
Commit status:
[Not Reviewed]
References:
Diff options:
Comments:
0 Commit comments
0 Inline Comments
Unresolved TODOs:
There are no unresolved TODOs
r49:5746784ead66 - - 2 files changed: 11 inserted, 2 deleted
@@ -21,6 +21,11 | |||||
|
21 | end |
|
21 | end |
|
22 | end |
|
22 | end |
|
23 |
|
23 | ||
|
|
24 | + | ||
|
|
25 | + puts "This script is out of dated, shall be fixed soon" | ||
|
|
26 | + puts "Right now, you can create raw_ev and import" | ||
|
|
27 | + exit(0) | ||
|
|
28 | + | ||
|
24 | GRADER_DIR = File.dirname(__FILE__) |
|
29 | GRADER_DIR = File.dirname(__FILE__) |
|
25 |
|
30 | ||
|
26 | # print usage |
|
31 | # print usage |
@@ -58,7 +63,7 | |||||
|
58 | # generating all_tests.cfg |
|
63 | # generating all_tests.cfg |
|
59 | puts "generating testcase config file" |
|
64 | puts "generating testcase config file" |
|
60 |
|
65 | ||
|
61 | - template = File.open(File.dirname(__FILE__) + "/all_tests.cfg.erb").read |
|
66 | + template = File.open(File.dirname(__FILE__) + "/templates/all_tests.cfg.erb").read |
|
62 | all_test_cfg = ERB.new(template) |
|
67 | all_test_cfg = ERB.new(template) |
|
63 |
|
68 | ||
|
64 | cfg_file = File.open("#{problem}/test_cases/all_tests.cfg","w") |
|
69 | cfg_file = File.open("#{problem}/test_cases/all_tests.cfg","w") |
@@ -44,6 +44,7 | |||||
|
44 | static volatile int timer_tick; |
|
44 | static volatile int timer_tick; |
|
45 | static time_t start_time; |
|
45 | static time_t start_time; |
|
46 | static int ticks_per_sec; |
|
46 | static int ticks_per_sec; |
|
|
47 | + static int page_size; | ||
|
47 |
|
48 | ||
|
48 | #if defined(__GLIBC__) && __GLIBC__ == 2 && __GLIBC_MINOR__ > 0 |
|
49 | #if defined(__GLIBC__) && __GLIBC__ == 2 && __GLIBC_MINOR__ > 0 |
|
49 | /* glibc 2.1 or newer -> has lseek64 */ |
|
50 | /* glibc 2.1 or newer -> has lseek64 */ |
@@ -384,9 +385,11 | |||||
|
384 | //printf("%s\n",line); |
|
385 | //printf("%s\n",line); |
|
385 | int m; |
|
386 | int m; |
|
386 |
|
387 | ||
|
387 | - if(sscanf(line,"%d",&m)==1) |
|
388 | + if(sscanf(line,"%d",&m)==1) { |
|
|
389 | + m = (m*page_size+1023)/1024; | ||
|
388 | if(m>max_mem_used) |
|
390 | if(m>max_mem_used) |
|
389 | max_mem_used = m; |
|
391 | max_mem_used = m; |
|
|
392 | + } | ||
|
390 |
|
393 | ||
|
391 | fclose(fp); |
|
394 | fclose(fp); |
|
392 | } |
|
395 | } |
@@ -404,6 +407,7 | |||||
|
404 | sigaction(SIGINT, &sa, NULL); |
|
407 | sigaction(SIGINT, &sa, NULL); |
|
405 | start_time = time(NULL); |
|
408 | start_time = time(NULL); |
|
406 | ticks_per_sec = sysconf(_SC_CLK_TCK); |
|
409 | ticks_per_sec = sysconf(_SC_CLK_TCK); |
|
|
410 | + page_size = getpagesize(); | ||
|
407 | if (ticks_per_sec <= 0) |
|
411 | if (ticks_per_sec <= 0) |
|
408 | die("Invalid ticks_per_sec!"); |
|
412 | die("Invalid ticks_per_sec!"); |
|
409 |
|
413 |
You need to be logged in to leave comments.
Login now