File tree 3 files changed +12
-7
lines changed
cachelib/cachebench/cache
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,
22
22
false ,
23
23
" Enable reporting cache API latency tracking" );
24
24
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." );
28
29
29
30
namespace facebook {
30
31
namespace cachelib {
Original file line number Diff line number Diff line change 44
44
#include " cachelib/cachebench/util/NandWrites.h"
45
45
46
46
DECLARE_bool (report_api_latency);
47
- DECLARE_bool (report_memory_usage_stats);
47
+ DECLARE_string (report_memory_usage_stats);
48
48
49
49
namespace facebook {
50
50
namespace cachelib {
Original file line number Diff line number Diff line change 21
21
#include " cachelib/common/PercentileStats.h"
22
22
23
23
DECLARE_bool (report_api_latency);
24
- DECLARE_bool (report_memory_usage_stats);
24
+ DECLARE_string (report_memory_usage_stats);
25
25
26
26
namespace facebook {
27
27
namespace cachelib {
@@ -135,12 +135,16 @@ struct Stats {
135
135
<< std::endl;
136
136
}
137
137
138
- if (FLAGS_report_memory_usage_stats) {
138
+ if (FLAGS_report_memory_usage_stats != " " ) {
139
139
for (TierId tid = 0 ; tid < slabsApproxFreePercentages.size (); tid++) {
140
140
out << folly::sformat (" tid{:2} free slabs : {:.2f}%" , tid, slabsApproxFreePercentages[tid]) << std::endl;
141
141
}
142
142
143
- auto formatMemory = [](size_t bytes) -> std::tuple<std::string, double > {
143
+ auto formatMemory = [&](size_t bytes) -> std::tuple<std::string, double > {
144
+ if (FLAGS_report_memory_usage_stats == " raw" ) {
145
+ return {" B" , bytes};
146
+ }
147
+
144
148
constexpr double KB = 1024.0 ;
145
149
constexpr double MB = 1024.0 * 1024 ;
146
150
constexpr double GB = 1024.0 * 1024 * 1024 ;
You can’t perform that action at this time.
0 commit comments