Skip to content

Commit

Permalink
common: change default value for perfcounter description ("NO_INFO_FI…
Browse files Browse the repository at this point in the history
…X">NULL)

Signed-off-by: Alyona Kiseleva <[email protected]>
  • Loading branch information
Ved-vampir committed Feb 25, 2015
1 parent 1fa56d9 commit 94e47cf
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 8 deletions.
5 changes: 4 additions & 1 deletion src/common/perf_counters.cc
Original file line number Diff line number Diff line change
Expand Up @@ -292,7 +292,10 @@ void PerfCounters::dump_formatted(Formatter *f, bool schema,
if (schema) {
f->open_object_section(d->name);
f->dump_int("type", d->type);
f->dump_string("description", d->description);
if (d->description)
f->dump_string("description", d->description);
else
f->dump_string("description", "");
f->close_section();
} else {
if (d->type & PERFCOUNTER_LONGRUNAVG) {
Expand Down
10 changes: 5 additions & 5 deletions src/common/perf_counters.h
Original file line number Diff line number Diff line change
Expand Up @@ -239,11 +239,11 @@ class PerfCountersBuilder
PerfCountersBuilder(CephContext *cct, const std::string &name,
int first, int last);
~PerfCountersBuilder();
void add_u64(int key, const char *name, const char *description = "NO_INFO_FIX");
void add_u64_counter(int key, const char *name, const char *description = "NO_INFO_FIX");
void add_u64_avg(int key, const char *name, const char *description = "NO_INFO_FIX");
void add_time(int key, const char *name, const char *description = "NO_INFO_FIX");
void add_time_avg(int key, const char *name, const char *description = "NO_INFO_FIX");
void add_u64(int key, const char *name, const char *description = NULL);
void add_u64_counter(int key, const char *name, const char *description = NULL);
void add_u64_avg(int key, const char *name, const char *description = NULL);
void add_time(int key, const char *name, const char *description = NULL);
void add_time_avg(int key, const char *name, const char *description = NULL);
PerfCounters* create_perf_counters();
private:
PerfCountersBuilder(const PerfCountersBuilder &rhs);
Expand Down
4 changes: 2 additions & 2 deletions src/test/perf_counters.cc
Original file line number Diff line number Diff line change
Expand Up @@ -182,8 +182,8 @@ TEST(PerfCounters, MultiplePerfCounters) {
"\"element3\":{\"avgcount\":0,\"sum\":0.000000000}}}"), msg);
ASSERT_EQ("", client.do_request("{ \"prefix\": \"perf schema\", \"format\": \"json\" }", &msg));

ASSERT_EQ(sd("{\"test_perfcounter_1\":{\"element1\":{\"type\":2,\"description\":\"NO_INFO_FIX\"},"
"\"element2\":{\"type\":1,\"description\":\"NO_INFO_FIX\"},\"element3\":{\"type\":5,\"description\":\"NO_INFO_FIX\"}}}"), msg);
ASSERT_EQ(sd("{\"test_perfcounter_1\":{\"element1\":{\"type\":2,\"description\":\"\"},"
"\"element2\":{\"type\":1,\"description\":\"\"},\"element3\":{\"type\":5,\"description\":\"\"}}}"), msg);

coll->clear();
ASSERT_EQ("", client.do_request("{ \"prefix\": \"perf dump\", \"format\": \"json\" }", &msg));
Expand Down

0 comments on commit 94e47cf

Please sign in to comment.