forked from OSchip/llvm-project
parent
81c423cc97
commit
1199dc0327
|
@ -10,7 +10,7 @@ const size_t kNumThreds = 16;
|
||||||
const size_t kNumIters = 1 << 20;
|
const size_t kNumIters = 1 << 20;
|
||||||
|
|
||||||
|
|
||||||
void *MallocThread(void *t) {
|
static void *MallocThread(void *t) {
|
||||||
size_t total_malloced = 0, total_freed = 0;
|
size_t total_malloced = 0, total_freed = 0;
|
||||||
size_t max_in_use = 0;
|
size_t max_in_use = 0;
|
||||||
size_t tid = reinterpret_cast<size_t>(t);
|
size_t tid = reinterpret_cast<size_t>(t);
|
||||||
|
@ -48,8 +48,8 @@ void *MallocThread(void *t) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Build with -Dstandalone_malloc_test=main to make it a separate program.
|
||||||
int main() {
|
int standalone_malloc_test() {
|
||||||
pthread_t t[kNumThreds];
|
pthread_t t[kNumThreds];
|
||||||
for (size_t i = 0; i < kNumThreds; i++)
|
for (size_t i = 0; i < kNumThreds; i++)
|
||||||
pthread_create(&t[i], 0, MallocThread, reinterpret_cast<void *>(i));
|
pthread_create(&t[i], 0, MallocThread, reinterpret_cast<void *>(i));
|
||||||
|
|
Loading…
Reference in New Issue