contributed by <illusion030
>
illusion030@illusion030-X550LD:~/Desktop/2017sysprog/phonebook-concurrent$ lscpu
Architecture: x86_64
CPU 作業模式: 32-bit, 64-bit
Byte Order: Little Endian
CPU(s): 4
On-line CPU(s) list: 0-3
每核心執行緒數:2
每通訊端核心數:2
Socket(s): 1
NUMA 節點: 1
供應商識別號: GenuineIntel
CPU 家族: 6
型號: 69
Model name: Intel(R) Core(TM) i5-4200U CPU @ 1.60GHz
製程: 1
CPU MHz: 1649.475
CPU max MHz: 2600.0000
CPU min MHz: 800.0000
BogoMIPS: 4588.95
虛擬: VT-x
L1d 快取: 32K
L1i 快取: 32K
L2 快取: 256K
L3 快取: 3072K
NUMA node0 CPU(s): 0-3
struct __PHONEBOOK_API__ pb = {
.findLastName = orig_findName,
.append = orig_append,
.write = orig_write,
.free = orig_free,
};
struct __PHONEBOOK_API__ pb = {
.findLastName = opt_findLastName,
.append = opt_append,
.write = opt_write,
.free = opt_free,
};
pthread_mutex_t lock;
threadpool_t *pool;
pthread_mutex_init(&lock, NULL);
assert((pool = threadpool_create(THREAD_NUM, QUEUE_SIZE)) != NULL);
for (i = 0; i < TASK_NUM; i++)
threadpool_add(pool, (void *)&threads_append, (void *)thread_args[i]);
while(TASK_NUM != done) ;
assert(threadpool_destroy(pool, 0) == 0);
max = 0.144134 in 5301
min = 0.072556 in 1301
要注意是否有 lock contention,可用 mutrace 追蹤 –jserv