You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

16 lines
462 B

  1. -- returns the PID and memory peak of lua process itself
  2. local process_information = function ()
  3. local result = { memory_peak = 0, PID = nil}
  4. for lines in io.lines ('/proc/self/status') do
  5. if (lines:find ("Pid:") == 1) then
  6. result["PID"] = lines:match ("%d+")
  7. end
  8. if (lines:find ("VmPeak:") == 1) then
  9. result["memory_peak"] = lines:match ("%d+")
  10. end
  11. end
  12. return result
  13. end
  14. return { process_information = process_information }