integrated realtimegc stuff into testament
This commit is contained in:
parent
c1d0b2403b
commit
c55f884b5c
7 changed files with 78 additions and 38 deletions
46
tests/realtimeGC/nmain.nim
Normal file
46
tests/realtimeGC/nmain.nim
Normal file
|
|
@ -0,0 +1,46 @@
|
|||
discard """
|
||||
cmd: "nim $target --debuginfo $options $file"
|
||||
output: "Done"
|
||||
"""
|
||||
|
||||
import times, os, threadpool
|
||||
|
||||
const RUNTIME = 15 * 60 # 15 minutes
|
||||
|
||||
when defined(windows):
|
||||
const dllname = "./tests/realtimeGC/shared.dll"
|
||||
elif defined(macosx):
|
||||
const dllname = "./tests/realtimeGC/libshared.dylib"
|
||||
else:
|
||||
const dllname = "./tests/realtimeGC/libshared.so"
|
||||
|
||||
proc status() {.importc: "status", dynlib: dllname.}
|
||||
proc count() {.importc: "count", dynlib: dllname.}
|
||||
proc checkOccupiedMem() {.importc: "checkOccupiedMem", dynlib: dllname.}
|
||||
|
||||
proc process() =
|
||||
let startTime = getTime()
|
||||
let runTime = cast[Time](RUNTIME) #
|
||||
var accumTime: Time
|
||||
while accumTime < runTime:
|
||||
for i in 0..10:
|
||||
count()
|
||||
# echo("1. sleeping... ")
|
||||
sleep(500)
|
||||
for i in 0..10:
|
||||
status()
|
||||
# echo("2. sleeping... ")
|
||||
sleep(500)
|
||||
checkOccupiedMem()
|
||||
accumTime = cast[Time]((getTime() - startTime))
|
||||
# echo("--- Minutes left to run: ", int(int(runTime-accumTime)/60))
|
||||
|
||||
proc main() =
|
||||
process()
|
||||
# parallel:
|
||||
# for i in 0..0:
|
||||
# spawn process()
|
||||
# sync()
|
||||
echo("Done")
|
||||
|
||||
main()
|
||||
Loading…
Add table
Add a link
Reference in a new issue