5 struct stat_area *STATS = NULL;
8 +#define ALIGN64(val) ((val+7)&~7)
10 int ci_stat_memblock_size(void)
12 - return sizeof(struct stat_memblock)+STAT_INT64.entries_num*sizeof(uint64_t)+STAT_KBS.entries_num*sizeof(kbs_t);
13 + return ALIGN64(sizeof(struct stat_memblock))+STAT_INT64.entries_num*sizeof(uint64_t)+STAT_KBS.entries_num*sizeof(kbs_t);
16 int stat_entry_by_name(struct stat_entry_list *list, const char *label);
18 ci_thread_mutex_init(&(area->mtx));
19 area->mem_block = mem_block;
20 area->release_mem = release_mem;
21 - area->mem_block->counters64 = mem_block + sizeof(struct stat_memblock);
22 - area->mem_block->counterskbs = mem_block + sizeof(struct stat_memblock) + STAT_INT64.entries_num*sizeof(uint64_t);
23 + area->mem_block->counters64 = mem_block + ALIGN64(sizeof(struct stat_memblock));
24 + area->mem_block->counterskbs = mem_block + ALIGN64(sizeof(struct stat_memblock)) + STAT_INT64.entries_num*sizeof(uint64_t);
25 area->mem_block->counters64_size = STAT_INT64.entries_num;
26 area->mem_block->counterskbs_size = STAT_KBS.entries_num;
27 ci_stat_area_reset(area);
29 assert(mem_block->sig == MEMBLOCK_SIG);
30 mem_block->counters64_size = STAT_INT64.entries_num;
31 mem_block->counterskbs_size = STAT_KBS.entries_num;
32 - mem_block->counters64 = (void *)mem_block + sizeof(struct stat_memblock);
33 - mem_block->counterskbs = (void *)mem_block + sizeof(struct stat_memblock)
34 - + mem_block->counters64_size*sizeof(uint64_t);
35 + mem_block->counters64 = (void *)mem_block + ALIGN64(sizeof(struct stat_memblock));
36 + mem_block->counterskbs = (void *)mem_block + ALIGN64(sizeof(struct stat_memblock))
37 + + mem_block->counters64_size*sizeof(uint64_t);
40 /*Reconstruct a memblock which is located to a continues memory block*/
41 void stat_memblock_reconstruct(struct stat_memblock *mem_block)
43 assert(mem_block->sig == MEMBLOCK_SIG);
44 - mem_block->counters64 = (void *)mem_block + sizeof(struct stat_memblock);
45 - mem_block->counterskbs = (void *)mem_block + sizeof(struct stat_memblock)
46 + mem_block->counters64 = (void *)mem_block + ALIGN64(sizeof(struct stat_memblock));
47 + mem_block->counterskbs = (void *)mem_block + ALIGN64(sizeof(struct stat_memblock))
48 + mem_block->counters64_size*sizeof(uint64_t);