20 #ifndef RIPPLE_PATH_IMPL_FLOWDEBUGINFO_H_INCLUDED
21 #define RIPPLE_PATH_IMPL_FLOWDEBUGINFO_H_INCLUDED
23 #include <ripple/app/paths/impl/AmountSpec.h>
24 #include <ripple/basics/IOUAmount.h>
25 #include <ripple/basics/XRPAmount.h>
26 #include <ripple/ledger/PaymentSandbox.h>
28 #include <boost/container/flat_map.hpp>
42 boost::container::flat_map<std::string, std::pair<time_point, time_point>>
44 boost::container::flat_map<std::string, std::size_t>
counts;
85 out.push_back(out_amt);
128 auto const& t = i->second;
129 return std::chrono::duration_cast<std::chrono::duration<double>>(
136 auto i =
counts.find(tag);
151 : tag(std::move(name)), info(&pi)
161 Stopper(Stopper&&) =
default;
163 return Stopper(std::move(name), *
this);
169 auto i =
counts.find(tag);
217 ostr <<
"duration: " << d.count() <<
", pass_count: " <<
passCount();
222 [&ostr](
auto const& vals,
auto&& fun,
char delim =
';') {
226 ostr << fun(vals[0]);
227 for (
size_t i = 1, e = vals.size(); i < e; ++i)
228 ostr << delim << fun(vals[i]);
232 auto writeXrpAmtList = [&write_list](
238 write_list(amts, get_val, delim);
240 auto writeIouAmtList = [&write_list](
246 write_list(amts, get_val, delim);
248 auto writeIntList = [&write_list](
251 auto get_val = [](
size_t const& v) ->
size_t const& {
254 write_list(vals, get_val);
256 auto writeNestedIouAmtList =
257 [&ostr, &writeIouAmtList](
262 writeIouAmtList(amts[0],
'|');
263 for (
size_t i = 1, e = amts.
size(); i < e; ++i)
266 writeIouAmtList(amts[i],
'|');
271 auto writeNestedXrpAmtList =
272 [&ostr, &writeXrpAmtList](
277 writeXrpAmtList(amts[0],
'|');
278 for (
size_t i = 1, e = amts.
size(); i < e; ++i)
281 writeXrpAmtList(amts[i],
'|');
287 ostr <<
", in_pass: ";
292 ostr <<
", out_pass: ";
297 ostr <<
", num_active: ";
302 ostr <<
", l_src_in: ";
307 ostr <<
", l_src_out: ";
325 auto const k = elem.first;
326 auto const v = elem.second;
327 ostr << '[' << get<0>(k) <<
'|' << get<1>(k) <<
'|' << get<2>(k) <<
'|' << v
331 template <
class Iter>
364 auto const& diffs = bd->first;
365 auto const& xrpDestroyed = bd->second;
367 ostr <<
", xrpDestroyed: " <<
to_string(xrpDestroyed);
368 ostr <<
", balanceDiffs: ";
void writeDiffs(std::ostringstream &ostr, Iter begin, Iter end)
XRPAmount xrpDestroyed() const
void push_back(EitherAmount const &in_amt, EitherAmount const &out_amt, std::size_t active)
void pushLiquiditySrc(EitherAmount const &in, EitherAmount const &out)
boost::container::flat_map< std::string, std::pair< time_point, time_point > > timePoints
A wrapper which makes credits unavailable to balances.
std::vector< size_t > numActive
void inc(std::string const &tag)
BalanceDiffs balanceDiffs(PaymentSandbox const &sb, ReadView const &rv)
std::pair< std::map< std::tuple< AccountID, AccountID, Currency >, STAmount >, XRPAmount > BalanceDiffs
std::vector< std::vector< EitherAmount > > liquiditySrcOut
std::size_t count(std::string const &tag) const
std::string to_string(bool writePassInfo) const
std::map< std::tuple< AccountID, AccountID, Currency >, STAmount > balanceChanges(ReadView const &view) const
auto duration(std::string const &tag) const
FlowDebugInfo(bool nativeIn, bool nativeOut)
PassInfo(bool nativeIn_, bool nativeOut_)
std::string balanceDiffsToString(std::optional< BalanceDiffs > const &bd)
auto timeBlock(std::string name)
std::vector< std::vector< EitherAmount > > liquiditySrcIn
void setCount(std::string const &tag, std::size_t c)
std::size_t passCount() const
void pushLiquiditySrc(EitherAmount const &eIn, EitherAmount const &eOut)
Use hash_* containers for keys that do not need a cryptographically secure hashing algorithm.
clock::time_point time_point
void writeDiffElement(std::ostringstream &ostr, std::pair< std::tuple< AccountID, AccountID, Currency >, STAmount > const &elem)
std::string to_string(Manifest const &m)
Format the specified manifest to a string for debugging purposes.
void pushPass(EitherAmount const &in, EitherAmount const &out, std::size_t activeStrands)
boost::container::flat_map< std::string, std::size_t > counts
std::vector< EitherAmount > in
std::vector< EitherAmount > out