MCPcopy Create free account
hub / github.com/CppCXY/EmmyLuaCodeStyle / main

Function main

3rd/mimalloc-2.0.9/test/test-stress.c:224–272  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

222#endif
223
224int main(int argc, char** argv) {
225 // > mimalloc-test-stress [THREADS] [SCALE] [ITER]
226 if (argc >= 2) {
227 char* end;
228 long n = strtol(argv[1], &end, 10);
229 if (n > 0) THREADS = n;
230 }
231 if (argc >= 3) {
232 char* end;
233 long n = (strtol(argv[2], &end, 10));
234 if (n > 0) SCALE = n;
235 }
236 if (argc >= 4) {
237 char* end;
238 long n = (strtol(argv[3], &end, 10));
239 if (n > 0) ITER = n;
240 }
241 printf("Using %d threads with a %d%% load-per-thread and %d iterations\n", THREADS, SCALE, ITER);
242 //mi_reserve_os_memory(1024*1024*1024ULL, false, true);
243 //int res = mi_reserve_huge_os_pages(4,1);
244 //printf("(reserve huge: %i\n)", res);
245
246 //bench_start_program();
247
248 // Run ITER full iterations where half the objects in the transfer buffer survive to the next round.
249 srand(0x7feb352d);
250
251 //mi_reserve_os_memory(512ULL << 20, true, true);
252
253#if !defined(NDEBUG) && !defined(USE_STD_MALLOC)
254 mi_stats_reset();
255#endif
256
257#ifdef STRESS
258 test_stress();
259#else
260 test_leak();
261#endif
262
263#ifndef USE_STD_MALLOC
264 #ifndef NDEBUG
265 mi_collect(true);
266 //mi_debug_show_arenas();
267 #endif
268 mi_stats_print(NULL);
269#endif
270 //bench_end_program();
271 return 0;
272}
273
274
275static void (*thread_entry_fun)(intptr_t) = &stress;

Callers

nothing calls this directly

Calls 5

mi_stats_resetFunction · 0.85
test_stressFunction · 0.85
test_leakFunction · 0.85
mi_collectFunction · 0.85
mi_stats_printFunction · 0.85

Tested by

no test coverage detected