Merge pull request #42456 from ifed01/wip-ifed-alloc-histogram2

os/bluestore: implement allocation perf histogram.

Reviewed-by: Kefu Chai <kchai@redhat.com>
This commit is contained in:
Igor Fedotov 2021-07-26 13:21:28 +03:00 committed by GitHub
commit 8c49d56b93
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 30 additions and 4 deletions

View File

@ -5030,6 +5030,27 @@ void BlueStore::_init_logger()
b.add_time_avg(l_bluestore_remove_lat, "remove_lat",
"Average removal latency");
// Resulting size axis configuration for op histograms, values are in bytes
PerfHistogramCommon::axis_config_d alloc_hist_x_axis_config{
"Given size (bytes)",
PerfHistogramCommon::SCALE_LOG2, ///< Request size in logarithmic scale
0, ///< Start at 0
4096, ///< Quantization unit
13, ///< Enough to cover 4+M requests
};
// Req size axis configuration for op histograms, values are in bytes
PerfHistogramCommon::axis_config_d alloc_hist_y_axis_config{
"Request size (bytes)",
PerfHistogramCommon::SCALE_LOG2, ///< Request size in logarithmic scale
0, ///< Start at 0
4096, ///< Quantization unit
13, ///< Enough to cover 4+M requests
};
b.add_u64_counter_histogram(
l_bluestore_allocate_hist, "allocate_histogram",
alloc_hist_x_axis_config, alloc_hist_y_axis_config,
"Histogram of requested block allocations vs. given ones");
logger = b.create_perf_counters();
cct->get_perfcounters_collection()->add(logger);
}
@ -14138,7 +14159,7 @@ int BlueStore::_do_alloc_write(
}
return -ENOSPC;
}
_collect_allocation_stats(need, min_alloc_size, prealloc.size());
_collect_allocation_stats(need, min_alloc_size, prealloc);
dout(20) << __func__ << " prealloc " << prealloc << dendl;
auto prealloc_pos = prealloc.begin();
@ -16123,11 +16144,15 @@ void BlueStore::_log_alerts(osd_alert_list_t& alerts)
}
void BlueStore::_collect_allocation_stats(uint64_t need, uint32_t alloc_size,
size_t extents)
const PExtentVector& extents)
{
alloc_stats_count++;
alloc_stats_fragments += extents;
alloc_stats_fragments += extents.size();
alloc_stats_size += need;
for (auto& e : extents) {
logger->hinc(l_bluestore_allocate_hist, e.length, need);
}
}
void BlueStore::_record_allocation_stats()

View File

@ -144,6 +144,7 @@ enum {
l_bluestore_omap_get_values_lat,
l_bluestore_clist_lat,
l_bluestore_remove_lat,
l_bluestore_allocate_hist,
l_bluestore_last
};
@ -3357,7 +3358,7 @@ private:
unsigned bits);
void _collect_allocation_stats(uint64_t need, uint32_t alloc_size,
size_t extents);
const PExtentVector&);
void _record_allocation_stats();
private:
uint64_t probe_count = 0;