int si_profiler(siprofiler *p) { uint32_t temperature_total = 0; uint64_t memory_used = 0; ssrbnode *pn; sinode *n; pn = ss_rbmin(&p->i->i); while (pn) { n = sscast(pn, sinode, node); if (p->temperature_max < n->temperature) p->temperature_max = n->temperature; if (p->temperature_min > n->temperature) p->temperature_min = n->temperature; temperature_total += n->temperature; p->total_node_count++; p->count += n->i0.count; p->count += n->i1.count; p->total_branch_count += n->branch_count; if (p->total_branch_max < n->branch_count) p->total_branch_max = n->branch_count; if (n->branch_count < 20) p->histogram_branch[n->branch_count]++; else p->histogram_branch_20plus++; memory_used += n->i0.used; memory_used += n->i1.used; sibranch *b = n->branch; while (b) { p->count += b->index.h->keys; p->count_dup += b->index.h->dupkeys; int indexsize = sd_indexsize_ext(b->index.h); p->total_snapshot_size += indexsize; p->total_node_size += indexsize + b->index.h->total; p->total_node_origin_size += indexsize + b->index.h->totalorigin; p->total_page_count += b->index.h->count; if (b->index.h->extensions & SD_INDEXEXT_AMQF) { p->total_amqf_size += sizeof(sdindexamqf) + sd_indexamqf(&b->index)->size; } b = b->next; } pn = ss_rbnext(&p->i->i, pn); } if (p->total_node_count > 0) { p->total_branch_avg = p->total_branch_count / p->total_node_count; p->temperature_avg = temperature_total / p->total_node_count; } p->memory_used = memory_used; p->read_disk = p->i->read_disk; p->read_cache = p->i->read_cache; si_profiler_histogram_branch(p); si_profiler_histogram_temperature(p); return 0; }
int si_profiler(siprofiler *p) { uint64_t memory_used = 0; srrbnode *pn; sinode *n; pn = sr_rbmin(&p->i->i); while (pn) { n = srcast(pn, sinode, node); p->total_node_count++; p->count += n->i0.count; p->count += n->i1.count; p->total_branch_count += n->branch_count; if (p->total_branch_max < n->branch_count) p->total_branch_max = n->branch_count; if (n->branch_count < 20) p->histogram_branch[n->branch_count]++; else p->histogram_branch_20plus++; memory_used += sv_indexused(&n->i0); memory_used += sv_indexused(&n->i1); sibranch *b = n->branch; while (b) { p->count += b->index.h->keys; p->count_dup += b->index.h->dupkeys; int indexsize = sd_indexsize(b->index.h); p->total_node_size += indexsize + b->index.h->total; p->total_node_origin_size += indexsize + b->index.h->totalorigin; b = b->next; } pn = sr_rbnext(&p->i->i, pn); } if (p->total_node_count > 0) p->total_branch_avg = p->total_branch_count / p->total_node_count; p->memory_used = memory_used; p->read_disk = p->i->read_disk; p->read_cache = p->i->read_cache; si_profiler_histogram_branch(p); return 0; }