File tree Expand file tree Collapse file tree 3 files changed +12
-7
lines changed
cachelib/cachebench/cache Expand file tree Collapse file tree 3 files changed +12
-7
lines changed Original file line number Diff line number Diff line change @@ -22,9 +22,10 @@ DEFINE_bool(report_api_latency,
2222 false ,
2323 " Enable reporting cache API latency tracking" );
2424
25- DEFINE_bool (report_memory_usage_stats,
26- false ,
27- " Enable reporting statistics for each allocation class" );
25+ DEFINE_string (report_memory_usage_stats,
26+ " " ,
27+ " Enable reporting statistics for each allocation class. Set to"
28+ " 'human_readable' to print KB/MB/GB or to 'raw' to print in bytes." );
2829
2930namespace facebook {
3031namespace cachelib {
Original file line number Diff line number Diff line change 3333#include " cachelib/cachebench/util/CacheConfig.h"
3434
3535DECLARE_bool (report_api_latency);
36- DECLARE_bool (report_memory_usage_stats);
36+ DECLARE_string (report_memory_usage_stats);
3737
3838namespace facebook {
3939namespace cachelib {
Original file line number Diff line number Diff line change 2121#include " cachelib/common/PercentileStats.h"
2222
2323DECLARE_bool (report_api_latency);
24- DECLARE_bool (report_memory_usage_stats);
24+ DECLARE_string (report_memory_usage_stats);
2525
2626namespace facebook {
2727namespace cachelib {
@@ -123,12 +123,16 @@ struct Stats {
123123 << std::endl;
124124 out << folly::sformat (" RAM Evictions : {:,}" , numEvictions) << std::endl;
125125
126- if (FLAGS_report_memory_usage_stats) {
126+ if (FLAGS_report_memory_usage_stats != " " ) {
127127 for (TierId tid = 0 ; tid < slabsApproxFreePercentages.size (); tid++) {
128128 out << folly::sformat (" tid{:2} free slabs : {:.2f}%" , tid, slabsApproxFreePercentages[tid]) << std::endl;
129129 }
130130
131- auto formatMemory = [](size_t bytes) -> std::tuple<std::string, double > {
131+ auto formatMemory = [&](size_t bytes) -> std::tuple<std::string, double > {
132+ if (FLAGS_report_memory_usage_stats == " raw" ) {
133+ return {" B" , bytes};
134+ }
135+
132136 constexpr double KB = 1024.0 ;
133137 constexpr double MB = 1024.0 * 1024 ;
134138 constexpr double GB = 1024.0 * 1024 * 1024 ;
You can’t perform that action at this time.
0 commit comments