MCPcopy Index your code
hub / github.com/mongodb/mongo-python-driver / runTest

Method runTest

test/performance/perf_test.py:185–211  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

183 return None
184
185 def runTest(self):
186 results = []
187 start = time.monotonic()
188 i = 0
189 while True:
190 i += 1
191 self.before()
192 with Timer() as timer:
193 if self.n_threads == 1:
194 self.do_task()
195 else:
196 threaded(self.n_threads, self.do_task)
197 self.after()
198 results.append(timer.interval)
199 duration = time.monotonic() - start
200 if duration > MIN_ITERATION_TIME and i >= NUM_ITERATIONS:
201 break
202 if duration > MAX_ITERATION_TIME:
203 with warnings.catch_warnings():
204 warnings.simplefilter("default")
205 warnings.warn(
206 f"{self.__class__.__name__} timed out after {MAX_ITERATION_TIME}s, completed {i}/{NUM_ITERATIONS} iterations."
207 )
208
209 break
210
211 self.results = results
212
213 def mp_map(self, map_func, files):
214 with mp.Pool(initializer=proc_init, initargs=(client_context.client_options,)) as pool:

Callers

nothing calls this directly

Calls 5

beforeMethod · 0.95
do_taskMethod · 0.95
afterMethod · 0.95
threadedFunction · 0.85
TimerClass · 0.70

Tested by

no test coverage detected