MCPcopy Create free account
hub / github.com/Snapchat/KeyDB / run

Method run

deps/memkind/src/test/alloc_performance_tests.cpp:56–99  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

54 }
55
56 float run(unsigned kind, unsigned call, size_t threads_number,
57 size_t alloc_size, unsigned mem_operations_num)
58 {
59 TaskFactory task_factory;
60 std::vector<Thread *> threads;
61 std::vector<Task *> tasks;
62 TypesConf func_calls;
63 TypesConf allocator_types;
64
65 func_calls.enable_type(FunctionCalls::FREE);
66 func_calls.enable_type(call);
67 allocator_types.enable_type(kind);
68
69 TaskConf conf = {
70 mem_operations_num, //number of memory operations
71 {
72 mem_operations_num, //number of memory operations
73 alloc_size, //min. size of single allocation
74 alloc_size //max. size of single allocatioion
75 },
76 func_calls, //enable function calls
77 allocator_types, //enable allocators
78 11, //random seed
79 false, //does not log memory operations and statistics to csv file
80 };
81
82 for (int i=0; i<threads_number; i++) {
83 Task *task = task_factory.create(conf);
84 tasks.push_back(task);
85 threads.push_back(new Thread(task));
86 conf.seed += 1;
87 }
88
89 ThreadsManager threads_manager(threads);
90 threads_manager.start();
91 threads_manager.barrier();
92
93 TimeStats time_stats;
94 for (int i=0; i<tasks.size(); i++) {
95 time_stats += tasks[i]->get_results();
96 }
97
98 return time_stats.stats[kind][call].total_time;
99 }
100
101 void run_test(unsigned kind, unsigned call, size_t threads_number,
102 size_t alloc_size, unsigned mem_operations_num)

Callers

nothing calls this directly

Calls 6

enable_typeMethod · 0.80
barrierMethod · 0.80
createMethod · 0.45
startMethod · 0.45
sizeMethod · 0.45
get_resultsMethod · 0.45

Tested by

no test coverage detected