SpendTimer 改输出到 std::cout ,以便 jupyter 可以捕获输出

This commit is contained in:
fasiondog 2024-03-29 03:02:24 +08:00
parent 4e61548020
commit 1a35e137b9

View File

@ -66,7 +66,10 @@ SpendTimer::~SpendTimer() {
#endif #endif
#else #else
printf("%5zu keep: %7.3f %s - %s\n", i, duration, unit.c_str(), m_keep_desc[i].c_str()); // printf("%5zu keep: %7.3f %s - %s\n", i, duration, unit.c_str(),
// m_keep_desc[i].c_str());
std::cout << std::setw(5) << " keep: " << i << std::setw(7) << std::setprecision(3)
<< duration << " " << unit << " - " << m_keep_desc[i] << std::endl;
#endif /* __ANDROID__ */ #endif /* __ANDROID__ */
} }
} }
@ -113,7 +116,8 @@ void SpendTimer::show() const {
#endif #endif
#else #else
printf("%s", outmsg); // printf("%s", outmsg);
std::cout << outmsg;
#endif /* __ANDROID__ */ #endif /* __ANDROID__ */
} }