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)[];
|
files?: (LocalFile | MemoryFile | PreparedFile | Pipe | null)[];
|
||||||
|
|
||||||
// limitations
|
// limitations
|
||||||
cpuLimit?: number; // s
|
cpuLimit?: number; // ns
|
||||||
realCpuLimit?: number; // s
|
realCpuLimit?: number; // ns
|
||||||
memoryLimit?: number; // byte
|
memoryLimit?: number; // byte
|
||||||
procLimit?: number;
|
procLimit?: number;
|
||||||
|
|
||||||
@ -141,7 +141,7 @@ Single (Require `apt install g++` inside the container):
|
|||||||
"name": "stderr",
|
"name": "stderr",
|
||||||
"max": 10240
|
"max": 10240
|
||||||
}],
|
}],
|
||||||
"cpuLimit": 10,
|
"cpuLimit": 10000000000,
|
||||||
"memoryLimit": 104857600,
|
"memoryLimit": 104857600,
|
||||||
"procLimit": 50,
|
"procLimit": 50,
|
||||||
"copyIn": {
|
"copyIn": {
|
||||||
@ -186,7 +186,7 @@ Multiple:
|
|||||||
"name": "stderr",
|
"name": "stderr",
|
||||||
"max": 10240
|
"max": 10240
|
||||||
}],
|
}],
|
||||||
"cpuLimit": 1,
|
"cpuLimit": 1000000000,
|
||||||
"memoryLimit": 1048576,
|
"memoryLimit": 1048576,
|
||||||
"procLimit": 50,
|
"procLimit": 50,
|
||||||
"copyIn": {
|
"copyIn": {
|
||||||
@ -204,7 +204,7 @@ Multiple:
|
|||||||
"name": "stderr",
|
"name": "stderr",
|
||||||
"max": 10240
|
"max": 10240
|
||||||
}],
|
}],
|
||||||
"cpuLimit": 1,
|
"cpuLimit": 1000000000,
|
||||||
"memoryLimit": 1048576,
|
"memoryLimit": 1048576,
|
||||||
"procLimit": 50,
|
"procLimit": 50,
|
||||||
"copyOut": ["stdout", "stderr"]
|
"copyOut": ["stdout", "stderr"]
|
||||||
|
|||||||
@ -15,8 +15,8 @@ type cmd struct {
|
|||||||
Env []string `json:"env,omitempty"`
|
Env []string `json:"env,omitempty"`
|
||||||
Files []*cmdFile `json:"files,omitempty"`
|
Files []*cmdFile `json:"files,omitempty"`
|
||||||
|
|
||||||
CPULimit float64 `json:"cpuLimit"`
|
CPULimit uint64 `json:"cpuLimit"`
|
||||||
RealCPULimit float64 `json:"realCpuLimit"`
|
RealCPULimit uint64 `json:"realCpuLimit"`
|
||||||
MemoryLimit uint64 `json:"memoryLimit"`
|
MemoryLimit uint64 `json:"memoryLimit"`
|
||||||
ProcLimit uint64 `json:"procLimit"`
|
ProcLimit uint64 `json:"procLimit"`
|
||||||
|
|
||||||
|
|||||||
@ -189,8 +189,8 @@ func prepareCmd(rc cmd) (*envexec.Cmd, map[string]bool, error) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
w := &waiter{
|
w := &waiter{
|
||||||
timeLimit: time.Duration(rc.CPULimit * float64(time.Second)),
|
timeLimit: time.Duration(rc.CPULimit),
|
||||||
realTimeLimit: time.Duration(rc.RealCPULimit * float64(time.Second)),
|
realTimeLimit: time.Duration(rc.RealCPULimit),
|
||||||
}
|
}
|
||||||
|
|
||||||
return &envexec.Cmd{
|
return &envexec.Cmd{
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user