Commit 6cb789b8 authored by Ivar Refsdal's avatar Ivar Refsdal

Add print memory usage

parent a5cc4bfd
......@@ -7,6 +7,7 @@ import tempfile
import time
import flask
import psutil
import werkzeug
from saveserver import current_milli_time, intWithCommas, measure_spent_time
......@@ -22,11 +23,14 @@ def hello(path):
ms = measure_spent_time()
stream,form,files = werkzeug.formparser.parse_form_data(flask.request.environ, stream_factory=custom_stream_factory)
total_size = 0
for fil in files.values():
print("saved form name",, "submitted as", fil.filename, "to temporary file",
total_size += os.path.getsize(
mb_per_s = "%.1f" % ((total_size / (1024.0*1024.0)) / ((1.0+ms(raw=True))/1000.0))
print("handling POST request, spent", ms(), "ms.", mb_per_s, "MB/s.", "Number of files:", len(files.values()))
process = psutil.Process(os.getpid())
print("memory usage: %.1f MiB" % (process.memory_info().rss / (1024.0*1024.0)))
return "Hello World!"
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment