MCPcopy Create free account
hub / github.com/WasmEdge/WasmEdge / dumpToLog

Method dumpToLog

include/common/statistics.h:154–188  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

152 }
153
154 void dumpToLog(const Configure &Conf) const noexcept {
155 using namespace std::literals;
156 auto Nano = [](auto &&Duration) {
157 return std::chrono::nanoseconds(Duration).count();
158 };
159 const auto &StatConf = Conf.getStatisticsConfigure();
160 if (StatConf.isTimeMeasuring() || StatConf.isInstructionCounting() ||
161 StatConf.isCostMeasuring()) {
162 spdlog::info("==================== Statistics ===================="sv);
163 }
164 if (StatConf.isTimeMeasuring()) {
165 spdlog::info(" Total execution time: {} ns"sv, Nano(getTotalExecTime()));
166 spdlog::info(" Wasm instructions execution time: {} ns"sv,
167 Nano(getWasmExecTime()));
168 spdlog::info(" Host functions execution time: {} ns"sv,
169 Nano(getHostFuncExecTime()));
170 }
171 if (StatConf.isInstructionCounting()) {
172 spdlog::info(" Executed wasm instructions count: {}"sv, getInstrCount());
173 }
174 if (StatConf.isCostMeasuring()) {
175 spdlog::info(" Gas costs: {}"sv, getTotalCost());
176 }
177 if (StatConf.isInstructionCounting() && StatConf.isTimeMeasuring()) {
178 const double IPS = getInstrPerSecond();
179 spdlog::info(" Instructions per second: {}"sv,
180 likely(!std::isnan(IPS))
181 ? static_cast<uint64_t>(IPS)
182 : std::numeric_limits<uint64_t>::max());
183 }
184 if (StatConf.isTimeMeasuring() || StatConf.isInstructionCounting() ||
185 StatConf.isCostMeasuring()) {
186 spdlog::info("======================= End ======================"sv);
187 }
188 }
189
190private:
191 std::vector<uint64_t> CostTab;

Callers 3

instantiateModuleMethod · 0.80
registerModuleMethod · 0.80
runFunctionMethod · 0.80

Calls 6

isnanFunction · 0.85
countMethod · 0.80
isTimeMeasuringMethod · 0.80
isInstructionCountingMethod · 0.80
isCostMeasuringMethod · 0.80
likelyFunction · 0.70

Tested by

no test coverage detected