nmain.nim 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. discard """
  2. cmd: "nim $target --debuginfo $options $file"
  3. output: "Done"
  4. """
  5. import times, os, threadpool
  6. const RUNTIME = 15 * 60 # 15 minutes
  7. when defined(windows):
  8. const dllname = "./tests/realtimeGC/shared.dll"
  9. elif defined(macosx):
  10. const dllname = "./tests/realtimeGC/libshared.dylib"
  11. else:
  12. const dllname = "./tests/realtimeGC/libshared.so"
  13. proc status() {.importc: "status", dynlib: dllname.}
  14. proc count() {.importc: "count", dynlib: dllname.}
  15. proc checkOccupiedMem() {.importc: "checkOccupiedMem", dynlib: dllname.}
  16. proc process() =
  17. let startTime = getTime()
  18. let runTime = cast[Time](RUNTIME) #
  19. var accumTime: Time
  20. while accumTime < runTime:
  21. for i in 0..10:
  22. count()
  23. # echo("1. sleeping... ")
  24. sleep(500)
  25. for i in 0..10:
  26. status()
  27. # echo("2. sleeping... ")
  28. sleep(500)
  29. checkOccupiedMem()
  30. accumTime = cast[Time]((getTime() - startTime))
  31. # echo("--- Minutes left to run: ", int(int(runTime-accumTime)/60))
  32. proc main() =
  33. process()
  34. # parallel:
  35. # for i in 0..0:
  36. # spawn process()
  37. # sync()
  38. echo("Done")
  39. main()