MCPcopy Create free account
hub / github.com/ElementsProject/elements / generateResultMeasurement

Function generateResultMeasurement

src/bench/nanobench.h:1642–1669  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1640}
1641
1642static void generateResultMeasurement(std::vector<Node> const& nodes, size_t idx, Result const& r, std::ostream& out) {
1643 for (auto const& n : nodes) {
1644 if (!generateFirstLast(n, idx, r.size(), out)) {
1645 ANKERL_NANOBENCH_LOG("n.type=" << static_cast<int>(n.type));
1646 switch (n.type) {
1647 case Node::Type::content:
1648 out.write(n.begin, std::distance(n.begin, n.end));
1649 break;
1650
1651 case Node::Type::inverted_section:
1652 throw std::runtime_error("got a inverted section inside measurement");
1653
1654 case Node::Type::section:
1655 throw std::runtime_error("got a section inside measurement");
1656
1657 case Node::Type::tag: {
1658 auto m = Result::fromString(std::string(n.begin, n.end));
1659 if (m == Result::Measure::_size || !r.has(m)) {
1660 out << 0.0;
1661 } else {
1662 out << r.get(idx, m);
1663 }
1664 break;
1665 }
1666 }
1667 }
1668 }
1669}
1670
1671static void generateResult(std::vector<Node> const& nodes, size_t idx, std::vector<Result> const& results, std::ostream& out) {
1672 auto const& r = results[idx];

Callers 2

generateResultFunction · 0.85
renderFunction · 0.85

Calls 5

generateFirstLastFunction · 0.85
hasMethod · 0.80
sizeMethod · 0.45
writeMethod · 0.45
getMethod · 0.45

Tested by

no test coverage detected