|
From: <Or...@us...> - 2008-07-08 18:41:28
|
Revision: 292
http://acmcontester.svn.sourceforge.net/acmcontester/?rev=292&view=rev
Author: Oracle_
Date: 2008-07-08 11:41:35 -0700 (Tue, 08 Jul 2008)
Log Message:
-----------
Source became more elegant.
Modified Paths:
--------------
ACMServer/trunk/sharp tester/SourceTest/SourceTest.cpp
ACMServer/trunk/sharp tester/tester/Program.cs
Modified: ACMServer/trunk/sharp tester/SourceTest/SourceTest.cpp
===================================================================
--- ACMServer/trunk/sharp tester/SourceTest/SourceTest.cpp 2008-07-06 20:49:54 UTC (rev 291)
+++ ACMServer/trunk/sharp tester/SourceTest/SourceTest.cpp 2008-07-08 18:41:35 UTC (rev 292)
@@ -427,7 +427,7 @@
SetErrorMode(SEM_FAILCRITICALERRORS|SEM_NOALIGNMENTFAULTEXCEPT|SEM_NOGPFAULTERRORBOX|SEM_NOOPENFILEERRORBOX);
lock();
- if (!FSecurity->RunProcess(bufW=StrToArrW(ExePath),TRUE,CREATE_SUSPENDED|CREATE_NO_WINDOW|NORMAL_PRIORITY_CLASS,&si,&pi,Results[index-1]->Details))
+ if (!FSecurity->RunProcess(bufW=StrToArrW(ExePath),TRUE,CREATE_SUSPENDED|CREATE_NO_WINDOW|ABOVE_NORMAL_PRIORITY_CLASS,&si,&pi,Results[index-1]->Details))
{
FreeArr(bufW);
Results[index-1]->points=0;
@@ -447,8 +447,8 @@
FreeArr(bufW);
unlock();
job=CreateJobObject(NULL,NULL);
- mem.BasicLimitInformation.LimitFlags=JOB_OBJECT_LIMIT_PROCESS_MEMORY;
- mem.ProcessMemoryLimit=Lim->MemoryLimit;
+ mem.BasicLimitInformation.LimitFlags=JOB_OBJECT_LIMIT_JOB_MEMORY;
+ mem.JobMemoryLimit=Lim->MemoryLimit;
SetInformationJobObject(job,JobObjectExtendedLimitInformation,&mem,sizeof(mem));
port.CompletionKey=(void*)index;
port.CompletionPort=CreateIoCompletionPort(INVALID_HANDLE_VALUE, 0, 0, 0);
@@ -468,7 +468,7 @@
{
TerminateJobObject(job,0);
Results[index-1]->res=TRes::trOL;
- Results[index-1]->Details+="Size of output file excided OutputLimit";
+ Results[index-1]->Details+="OutputLimit";
break;
}
QueryInformationJobObject(job,JobObjectBasicAccountingInformation,&acc,sizeof(acc),NULL);
@@ -509,7 +509,7 @@
}
needbreak=true;
break;
- case JOB_OBJECT_MSG_PROCESS_MEMORY_LIMIT:
+ case JOB_OBJECT_MSG_JOB_MEMORY_LIMIT:
Results[index-1]->res=TRes::trML;
Results[index-1]->Details+="Memory Limit";
needbreak=true;
@@ -537,19 +537,40 @@
}
Sleep(1);
}
-
- CloseHandle(si.hStdOutput);si.hStdOutput=NULL;
- CloseHandle(si.hStdInput);si.hStdInput=NULL;
- Sleep(CONST_SLEEP); //waiting for file
-
+ Results[index-1]->UsedRealTime=GetTickCount()-start;
QueryInformationJobObject(job,JobObjectExtendedLimitInformation,&mem,sizeof(mem),NULL);
QueryInformationJobObject(job,JobObjectBasicAccountingInformation,&acc,sizeof(acc),NULL);
- Results[index-1]->UsedMemory=mem.PeakProcessMemoryUsed;
+ Results[index-1]->UsedMemory=mem.PeakJobMemoryUsed;
Results[index-1]->UsedTime=(int)((acc.ThisPeriodTotalKernelTime.QuadPart+acc.ThisPeriodTotalUserTime.QuadPart)/10000);
- Results[index-1]->UsedRealTime=GetTickCount()-start;
+
if (Results[index-1]->res!=TRes::trAC) return;
+ if ((int)GetFileSize(si.hStdOutput,NULL)>Lim->OutputLimit)
+ {
+ Results[index-1]->res=TRes::trOL;
+ Results[index-1]->Details+="OutputLimit";
+ return;
+ }
+ if (CheckTL(Results[index-1]->UsedTime,Lim->TimeLimit))
+ {
+ Results[index-1]->res=TRes::trTL;
+ Results[index-1]->Details+="Time Limit";
+ return;
+ }
+
+ if (CheckRTL(Results[index-1]->UsedRealTime,Lim->RealTimeLimit))
+ {
+ Results[index-1]->res=TRes::trRTL;
+ Results[index-1]->Details+="Real time limit";
+ return;
+ }
+
+ CloseHandle(si.hStdOutput);si.hStdOutput=NULL;
+ CloseHandle(si.hStdInput);si.hStdInput=NULL;
+
+ Sleep(CONST_SLEEP); //waiting for file
+
if (!File::Exists(oupath))
{
Results[index-1]->res=TRes::trWA;
@@ -557,7 +578,7 @@
return;
}
- //Sleep(CONST_SLEEP); //waiting for closing all handles to this file
+ Sleep(CONST_SLEEP); //waiting for closing all handles to this file
TCheckAnsRes r=CheckAnswer(index,ReadFullFile(oupath),Results[index-1]->Details);
Modified: ACMServer/trunk/sharp tester/tester/Program.cs
===================================================================
--- ACMServer/trunk/sharp tester/tester/Program.cs 2008-07-06 20:49:54 UTC (rev 291)
+++ ACMServer/trunk/sharp tester/tester/Program.cs 2008-07-08 18:41:35 UTC (rev 292)
@@ -70,7 +70,7 @@
Console.WriteLine("Used Time: {0}", c.Summary.res.UsedTime);
Console.WriteLine("Used Memory: {0}", c.Summary.res.UsedMemory);
Console.WriteLine("Used Real Time: {0}", c.Summary.res.UsedRealTime);
- //Console.ReadKey();
+ Console.ReadKey();
index++;
c.Dispose();
}
@@ -84,6 +84,7 @@
/*Console.WriteLine("Used Time: {0} ms", (System.DateTime.Now.Ticks - start.Ticks)/10000);
Console.WriteLine("MAX: CompTime {0} ms, Time {1} ms, RealTime {2} ms, Memory {3} byte", ct.max, t.max, rt.max, mem.max);
Console.WriteLine("Diff: CompTime {0} ms, Time {1} ms, RealTime {2} ms, Memory {3} byte",ct.diff(),t.diff(),rt.diff(),mem.diff());*/
+ Console.WriteLine("------------FINISH----------------");
Console.ReadKey();
}
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|