@@ -135,25 +135,6 @@ def get_deterministic_priv_key(self):
135
135
assert len (self .PRIV_KEYS ) == MAX_NODES
136
136
return self .PRIV_KEYS [self .index ]
137
137
138
- def get_mem_rss_kilobytes (self ):
139
- """Get the memory usage (RSS) per `ps`.
140
-
141
- Returns None if `ps` is unavailable.
142
- """
143
- assert self .running
144
-
145
- try :
146
- return int (subprocess .check_output (
147
- ["ps" , "h" , "-o" , "rss" , "{}" .format (self .process .pid )],
148
- stderr = subprocess .DEVNULL ).split ()[- 1 ])
149
-
150
- # Avoid failing on platforms where ps isn't installed.
151
- #
152
- # We could later use something like `psutils` to work across platforms.
153
- except (FileNotFoundError , subprocess .SubprocessError ):
154
- self .log .exception ("Unable to get memory usage" )
155
- return None
156
-
157
138
def _node_msg (self , msg : str ) -> str :
158
139
"""Return a modified msg that identifies this node by its index as a debugging aid."""
159
140
return "[node %d] %s" % (self .index , msg )
@@ -332,33 +313,6 @@ def assert_debug_log(self, expected_msgs, timeout=2):
332
313
time .sleep (0.05 )
333
314
self ._raise_assertion_error ('Expected messages "{}" does not partially match log:\n \n {}\n \n ' .format (str (expected_msgs ), print_log ))
334
315
335
- @contextlib .contextmanager
336
- def assert_memory_usage_stable (self , * , increase_allowed = 0.03 ):
337
- """Context manager that allows the user to assert that a node's memory usage (RSS)
338
- hasn't increased beyond some threshold percentage.
339
-
340
- Args:
341
- increase_allowed (float): the fractional increase in memory allowed until failure;
342
- e.g. `0.12` for up to 12% increase allowed.
343
- """
344
- before_memory_usage = self .get_mem_rss_kilobytes ()
345
-
346
- yield
347
-
348
- after_memory_usage = self .get_mem_rss_kilobytes ()
349
-
350
- if not (before_memory_usage and after_memory_usage ):
351
- self .log .warning ("Unable to detect memory usage (RSS) - skipping memory check." )
352
- return
353
-
354
- perc_increase_memory_usage = (after_memory_usage / before_memory_usage ) - 1
355
-
356
- if perc_increase_memory_usage > increase_allowed :
357
- self ._raise_assertion_error (
358
- "Memory usage increased over threshold of {:.3f}% from {} to {} ({:.3f}%)" .format (
359
- increase_allowed * 100 , before_memory_usage , after_memory_usage ,
360
- perc_increase_memory_usage * 100 ))
361
-
362
316
@contextlib .contextmanager
363
317
def profile_with_perf (self , profile_name ):
364
318
"""
0 commit comments