File tree Expand file tree Collapse file tree 2 files changed +22
-0
lines changed Expand file tree Collapse file tree 2 files changed +22
-0
lines changed Original file line number Diff line number Diff line change @@ -271,6 +271,14 @@ def __init__(self):
271
271
default = os .environ .get ("MEMTX_ALLOCATOR" , "small" ),
272
272
help = """Memtx allocator type for tests""" )
273
273
274
+ parser .add_argument (
275
+ "--collect-statistics" ,
276
+ dest = "collect_statistics" ,
277
+ action = "store_true" ,
278
+ default = False ,
279
+ help = """Collect memory/disk host statistics usage.
280
+ Default: false.""" )
281
+
274
282
# XXX: We can use parser.parse_intermixed_args() on
275
283
# Python 3.7 to understand commands like
276
284
# ./test-run.py foo --exclude bar baz
Original file line number Diff line number Diff line change 1
1
import os
2
+ import re
2
3
import sys
3
4
import collections
4
5
import signal
@@ -233,6 +234,19 @@ def format_process(pid):
233
234
return 'process %d [%s; %s]' % (pid , status , cmdline )
234
235
235
236
237
+ def get_mem_stat_rss ():
238
+ rss = 'unknown'
239
+ pat = re .compile (r"^rss .*" )
240
+ try :
241
+ with open ('/sys/fs/cgroup/memory/memory.stat' , 'r' ) as f :
242
+ for line in f :
243
+ if pat .match (line ) is not None :
244
+ rss = line .split (' ' )[1 ]
245
+ except (OSError , IOError ):
246
+ pass
247
+ return rss
248
+
249
+
236
250
def set_fd_cloexec (socket ):
237
251
flags = fcntl .fcntl (socket , fcntl .F_GETFD )
238
252
fcntl .fcntl (socket , fcntl .F_SETFD , flags | fcntl .FD_CLOEXEC )
You can’t perform that action at this time.
0 commit comments