| 8535 | } |
| 8536 | |
| 8537 | void RedwoodMetrics::getFields(TraceEvent* e, std::string* s, bool skipZeroes) { |
| 8538 | std::pair<const char*, unsigned int> metrics[] = { { "BTreePreload", metric.btreeLeafPreload }, |
| 8539 | { "BTreePreloadExt", metric.btreeLeafPreloadExt }, |
| 8540 | { "", 0 }, |
| 8541 | { "OpSet", metric.opSet }, |
| 8542 | { "OpSetKeyBytes", metric.opSetKeyBytes }, |
| 8543 | { "OpSetValueBytes", metric.opSetValueBytes }, |
| 8544 | { "OpClear", metric.opClear }, |
| 8545 | { "OpClearKey", metric.opClearKey }, |
| 8546 | { "", 0 }, |
| 8547 | { "OpGet", metric.opGet }, |
| 8548 | { "OpGetRange", metric.opGetRange }, |
| 8549 | { "OpCommit", metric.opCommit }, |
| 8550 | { "", 0 }, |
| 8551 | { "PagerDiskWrite", metric.pagerDiskWrite }, |
| 8552 | { "PagerDiskRead", metric.pagerDiskRead }, |
| 8553 | { "PagerCacheHit", metric.pagerCacheHit }, |
| 8554 | { "PagerCacheMiss", metric.pagerCacheMiss }, |
| 8555 | { "", 0 }, |
| 8556 | { "PagerProbeHit", metric.pagerProbeHit }, |
| 8557 | { "PagerProbeMiss", metric.pagerProbeMiss }, |
| 8558 | { "PagerEvictUnhit", metric.pagerEvictUnhit }, |
| 8559 | { "PagerEvictFail", metric.pagerEvictFail }, |
| 8560 | { "", 0 }, |
| 8561 | { "PagerRemapFree", metric.pagerRemapFree }, |
| 8562 | { "PagerRemapCopy", metric.pagerRemapCopy }, |
| 8563 | { "PagerRemapSkip", metric.pagerRemapSkip }, |
| 8564 | { "", 0 } }; |
| 8565 | |
| 8566 | double elapsed = now() - startTime; |
| 8567 | |
| 8568 | if (e != nullptr) { |
| 8569 | for (auto& m : metrics) { |
| 8570 | char c = m.first[0]; |
| 8571 | if (c != 0 && (!skipZeroes || m.second != 0)) { |
| 8572 | e->detail(m.first, m.second); |
| 8573 | } |
| 8574 | } |
| 8575 | levels[0].metrics.events.toTraceEvent(e, 0); |
| 8576 | } |
| 8577 | |
| 8578 | if (s != nullptr) { |
| 8579 | for (auto& m : metrics) { |
| 8580 | if (*m.first == '\0') { |
| 8581 | *s += "\n"; |
| 8582 | } else if (!skipZeroes || m.second != 0) { |
| 8583 | *s += format("%-15s %-8u %8" PRId64 "/s ", m.first, m.second, int64_t(m.second / elapsed)); |
| 8584 | } |
| 8585 | } |
| 8586 | *s += levels[0].metrics.events.toString(0, elapsed); |
| 8587 | } |
| 8588 | |
| 8589 | auto const& evictor = DWALPager::PageCacheT::Evictor::getEvictor(); |
| 8590 | |
| 8591 | std::pair<const char*, int64_t> cacheMetrics[] = { { "PageCacheCount", evictor->getCountUsed() }, |
| 8592 | { "PageCacheMoved", evictor->getCountMoved() }, |
| 8593 | { "PageCacheSize", evictor->getSizeUsed() }, |
| 8594 | { "DecodeCacheSize", evictor->reservedSize } }; |
no test coverage detected