mirror of
https://github.com/criyle/go-judge.git
synced 2025-11-04 14:50:02 +08:00
CPU limit s -> ns
This commit is contained in:
parent
eb5dfec701
commit
51ad40a869
10
README.md
10
README.md
@ -71,8 +71,8 @@ interface Cmd {
|
||||
files?: (LocalFile | MemoryFile | PreparedFile | Pipe | null)[];
|
||||
|
||||
// limitations
|
||||
cpuLimit?: number; // s
|
||||
realCpuLimit?: number; // s
|
||||
cpuLimit?: number; // ns
|
||||
realCpuLimit?: number; // ns
|
||||
memoryLimit?: number; // byte
|
||||
procLimit?: number;
|
||||
|
||||
@ -141,7 +141,7 @@ Single (Require `apt install g++` inside the container):
|
||||
"name": "stderr",
|
||||
"max": 10240
|
||||
}],
|
||||
"cpuLimit": 10,
|
||||
"cpuLimit": 10000000000,
|
||||
"memoryLimit": 104857600,
|
||||
"procLimit": 50,
|
||||
"copyIn": {
|
||||
@ -186,7 +186,7 @@ Multiple:
|
||||
"name": "stderr",
|
||||
"max": 10240
|
||||
}],
|
||||
"cpuLimit": 1,
|
||||
"cpuLimit": 1000000000,
|
||||
"memoryLimit": 1048576,
|
||||
"procLimit": 50,
|
||||
"copyIn": {
|
||||
@ -204,7 +204,7 @@ Multiple:
|
||||
"name": "stderr",
|
||||
"max": 10240
|
||||
}],
|
||||
"cpuLimit": 1,
|
||||
"cpuLimit": 1000000000,
|
||||
"memoryLimit": 1048576,
|
||||
"procLimit": 50,
|
||||
"copyOut": ["stdout", "stderr"]
|
||||
|
||||
@ -15,8 +15,8 @@ type cmd struct {
|
||||
Env []string `json:"env,omitempty"`
|
||||
Files []*cmdFile `json:"files,omitempty"`
|
||||
|
||||
CPULimit float64 `json:"cpuLimit"`
|
||||
RealCPULimit float64 `json:"realCpuLimit"`
|
||||
CPULimit uint64 `json:"cpuLimit"`
|
||||
RealCPULimit uint64 `json:"realCpuLimit"`
|
||||
MemoryLimit uint64 `json:"memoryLimit"`
|
||||
ProcLimit uint64 `json:"procLimit"`
|
||||
|
||||
|
||||
@ -189,8 +189,8 @@ func prepareCmd(rc cmd) (*envexec.Cmd, map[string]bool, error) {
|
||||
}
|
||||
|
||||
w := &waiter{
|
||||
timeLimit: time.Duration(rc.CPULimit * float64(time.Second)),
|
||||
realTimeLimit: time.Duration(rc.RealCPULimit * float64(time.Second)),
|
||||
timeLimit: time.Duration(rc.CPULimit),
|
||||
realTimeLimit: time.Duration(rc.RealCPULimit),
|
||||
}
|
||||
|
||||
return &envexec.Cmd{
|
||||
|
||||
Loading…
Reference in New Issue
Block a user