Test the realtime GC, via long running process in a shared object, without linking nimrtl.dll/so.

This commit is contained in:
Joseph Poirier 2015-01-06 12:42:36 -06:00
commit e940e7d37b
7 changed files with 214 additions and 0 deletions

40
tests/realtimeGC/main.nim Normal file
View file

@ -0,0 +1,40 @@
discard """
cmd: " nim c main.nim"
final output: "Done!"
"""
import times
import os
const RUNTIME = 35 * 60 # 35 minutes
when defined(windows):
const dllname = "./server.dll"
elif defined(macosx):
const dllname = "./libserver.dylib"
else:
const dllname = "./libserver.so"
proc status() {.importc: "status", dynlib: dllname.}
proc count() {.importc: "count", dynlib: dllname.}
proc occupiedMem() {.importc: "occupiedMem", dynlib: dllname.}
proc main() =
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)
occupiedMem()
accumTime = cast[Time]((getTime() - startTime))
echo("--- Minutes left to run: ", int(int(runTime-accumTime)/60))
echo("Done")
main()