3#include <xrpl/ledger/PaymentSandbox.h>
4#include <xrpl/protocol/IOUAmount.h>
5#include <xrpl/protocol/XRPAmount.h>
7#include <boost/container/flat_map.hpp>
19 boost::container::flat_map<std::string, std::pair<time_point, time_point>>
timePoints;
20 boost::container::flat_map<std::string, std::size_t>
counts;
57 out.push_back(outAmt);
66 "xrpl::path::detail::FlowDebugInfo::pushLiquiditySrc : "
67 "non-empty liquidity source");
102 "xrpl::path::detail::FlowDebugInfo::duration : timepoint not "
107 auto const& t = i->second;
114 auto i =
counts.find(tag);
138 Stopper(Stopper&&) =
default;
140 return Stopper(std::move(name), *
this);
146 auto i =
counts.find(tag);
169 passInfo.pushBack(in, out, activeStrands);
191 ostr <<
"duration: " << d.count() <<
", pass_count: " <<
passCount();
195 auto writeList = [&ostr](
auto const& vals,
auto&& fun,
char delim =
';') {
199 ostr << fun(vals[0]);
200 for (
size_t i = 1, e = vals.size(); i < e; ++i)
201 ostr << delim << fun(vals[i]);
205 auto writeXrpAmtList = [&writeList](
210 writeList(amts, getVal, delim);
212 auto writeIouAmtList = [&writeList](
217 writeList(amts, getVal, delim);
221 auto getVal = [](
size_t const& v) ->
size_t const& {
return v; };
222 writeList(vals, getVal);
224 auto writeNestedIouAmtList =
229 writeIouAmtList(amts[0],
'|');
230 for (
size_t i = 1, e = amts.
size(); i < e; ++i)
233 writeIouAmtList(amts[i],
'|');
238 auto writeNestedXrpAmtList =
243 writeXrpAmtList(amts[0],
'|');
244 for (
size_t i = 1, e = amts.
size(); i < e; ++i)
247 writeXrpAmtList(amts[i],
'|');
253 ostr <<
", in_pass: ";
262 ostr <<
", out_pass: ";
271 ostr <<
", num_active: ";
273 if (!
passInfo.liquiditySrcIn.empty() && !
passInfo.liquiditySrcIn.back().empty())
275 ostr <<
", l_src_in: ";
278 writeNestedXrpAmtList(
passInfo.liquiditySrcIn);
282 writeNestedIouAmtList(
passInfo.liquiditySrcIn);
284 ostr <<
", l_src_out: ";
287 writeNestedXrpAmtList(
passInfo.liquiditySrcOut);
291 writeNestedIouAmtList(
passInfo.liquiditySrcOut);
306 auto const k = elem.first;
307 auto const v = elem.second;
308 ostr << '[' << get<0>(k) <<
'|' <<
get<1>(k) <<
'|' <<
get<2>(k) <<
'|' << v <<
']';
Floating point representation of amounts with high dynamic range.
T duration_cast(T... args)
void writeDiffs(std::ostringstream &ostr, Iter begin, Iter end)
void writeDiffElement(std::ostringstream &ostr, std::pair< std::tuple< AccountID, AccountID, Currency >, STAmount > const &elem)
T get(Section const §ion, std::string const &name, T const &defaultValue=T{})
Retrieve a key/value pair from a section.
std::string to_string(BaseUInt< Bits, Tag > const &a)
std::vector< std::vector< EitherAmount > > liquiditySrcOut
std::vector< EitherAmount > in
void pushBack(EitherAmount const &inAmt, EitherAmount const &outAmt, std::size_t active)
std::vector< size_t > numActive
void pushLiquiditySrc(EitherAmount const &eIn, EitherAmount const &eOut)
std::vector< EitherAmount > out
PassInfo(bool nativeIn, bool nativeOut)
std::vector< std::vector< EitherAmount > > liquiditySrcIn
void pushPass(EitherAmount const &in, EitherAmount const &out, std::size_t activeStrands)
void pushLiquiditySrc(EitherAmount const &in, EitherAmount const &out)
std::string toString(bool writePassInfo) const
std::size_t count(std::string const &tag) const
std::size_t passCount() const
FlowDebugInfo(bool nativeIn, bool nativeOut)
boost::container::flat_map< std::string, std::size_t > counts
clock::time_point time_point
void inc(std::string const &tag)
void setCount(std::string const &tag, std::size_t c)
auto duration(std::string const &tag) const
auto timeBlock(std::string name)
std::chrono::high_resolution_clock clock
boost::container::flat_map< std::string, std::pair< time_point, time_point > > timePoints