3#include <xrpld/app/paths/detail/AmountSpec.h>
5#include <xrpl/ledger/PaymentSandbox.h>
6#include <xrpl/protocol/IOUAmount.h>
7#include <xrpl/protocol/XRPAmount.h>
9#include <boost/container/flat_map.hpp>
23 boost::container::flat_map<std::string, std::pair<time_point, time_point>>
timePoints;
24 boost::container::flat_map<std::string, std::size_t>
counts;
61 out.push_back(out_amt);
70 "xrpl::path::detail::FlowDebugInfo::pushLiquiditySrc : "
71 "non-empty liquidity source");
106 "xrpl::path::detail::FlowDebugInfo::duration : timepoint not "
111 auto const& t = i->second;
112 return std::chrono::duration_cast<std::chrono::duration<double>>(t.second - t.first);
118 auto i =
counts.find(tag);
134 auto const start = FlowDebugInfo::clock::now();
139 auto const end = FlowDebugInfo::clock::now();
142 Stopper(Stopper&&) =
default;
144 return Stopper(std::move(name), *
this);
150 auto i =
counts.find(tag);
195 ostr <<
"duration: " << d.count() <<
", pass_count: " <<
passCount();
199 auto write_list = [&ostr](
auto const& vals,
auto&& fun,
char delim =
';') {
203 ostr << fun(vals[0]);
204 for (
size_t i = 1, e = vals.size(); i < e; ++i)
205 ostr << delim << fun(vals[i]);
211 write_list(amts, get_val, delim);
215 write_list(amts, get_val, delim);
218 auto get_val = [](
size_t const& v) ->
size_t const& {
return v; };
219 write_list(vals, get_val);
225 writeIouAmtList(amts[0],
'|');
226 for (
size_t i = 1, e = amts.
size(); i < e; ++i)
229 writeIouAmtList(amts[i],
'|');
238 writeXrpAmtList(amts[0],
'|');
239 for (
size_t i = 1, e = amts.
size(); i < e; ++i)
242 writeXrpAmtList(amts[i],
'|');
248 ostr <<
", in_pass: ";
253 ostr <<
", out_pass: ";
258 ostr <<
", num_active: ";
262 ostr <<
", l_src_in: ";
267 ostr <<
", l_src_out: ";
283 auto const k = elem.first;
284 auto const v = elem.second;
285 ostr << '[' << get<0>(k) <<
'|' << get<1>(k) <<
'|' << get<2>(k) <<
'|' << v <<
']';
298 for (; begin != end; ++begin)
319 auto const& diffs = bd->first;
320 auto const& xrpDestroyed = bd->second;
322 ostr <<
", xrpDestroyed: " <<
to_string(xrpDestroyed);
323 ostr <<
", balanceDiffs: ";
A wrapper which makes credits unavailable to balances.
XRPAmount xrpDestroyed() const
std::map< std::tuple< AccountID, AccountID, Currency >, STAmount > balanceChanges(ReadView const &view) const
BalanceDiffs balanceDiffs(PaymentSandbox const &sb, ReadView const &rv)
std::string balanceDiffsToString(std::optional< BalanceDiffs > const &bd)
void writeDiffs(std::ostringstream &ostr, Iter begin, Iter end)
void writeDiffElement(std::ostringstream &ostr, std::pair< std::tuple< AccountID, AccountID, Currency >, STAmount > const &elem)
Use hash_* containers for keys that do not need a cryptographically secure hashing algorithm.
std::string to_string(base_uint< Bits, Tag > const &a)
PassInfo(bool nativeIn_, bool nativeOut_)
std::vector< std::vector< EitherAmount > > liquiditySrcOut
std::vector< EitherAmount > in
std::vector< size_t > numActive
void pushLiquiditySrc(EitherAmount const &eIn, EitherAmount const &eOut)
std::vector< EitherAmount > out
void push_back(EitherAmount const &in_amt, EitherAmount const &out_amt, std::size_t active)
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::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
std::string to_string(bool writePassInfo) const
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)
boost::container::flat_map< std::string, std::pair< time_point, time_point > > timePoints