| 1263 | } |
| 1264 | |
| 1265 | void RuntimeProfileBase::ToJsonCounters(Verbosity verbosity, Value* parent, Document* d, |
| 1266 | const string& counter_name, const CounterMap& counter_map, |
| 1267 | const ChildCounterMap& child_counter_map) const { |
| 1268 | auto& allocator = d->GetAllocator(); |
| 1269 | ChildCounterMap::const_iterator itr = child_counter_map.find(counter_name); |
| 1270 | if (itr != child_counter_map.end()) { |
| 1271 | const set<string>& child_counters = itr->second; |
| 1272 | for (const string& child_counter: child_counters) { |
| 1273 | CounterMap::const_iterator iter = counter_map.find(child_counter); |
| 1274 | if (iter == counter_map.end()) continue; |
| 1275 | |
| 1276 | Value counter(kObjectType); |
| 1277 | iter->second->ToJson(verbosity, *d, &counter); |
| 1278 | counter.AddMember("counter_name", child_counter, allocator); |
| 1279 | |
| 1280 | Value child_counters_json(kArrayType); |
| 1281 | ToJsonCounters(verbosity, &child_counters_json, d, child_counter, counter_map, |
| 1282 | child_counter_map); |
| 1283 | if (!child_counters_json.Empty()){ |
| 1284 | counter.AddMember("child_counters", child_counters_json, allocator); |
| 1285 | } |
| 1286 | parent->PushBack(counter, allocator); |
| 1287 | } |
| 1288 | } |
| 1289 | } |
| 1290 | |
| 1291 | void RuntimeProfileBase::ToJsonHelper( |
| 1292 | Verbosity verbosity, Value* parent, Document* d) const { |