Skip to content

Commit

Permalink
[MetaSchedule] Clear screen only when specified (apache#14785)
Browse files Browse the repository at this point in the history
  • Loading branch information
junrushao authored May 6, 2023
1 parent 20ded77 commit bf1be35
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions src/meta_schedule/utils.h
Original file line number Diff line number Diff line change
Expand Up @@ -150,12 +150,16 @@ inline void print_interactive_table(const String& data) {
* \param logging_func The logging function.
*/
inline void clear_logging(const char* file, int lineno, PackedFunc logging_func) {
if (logging_func.defined() && using_ipython()) {
logging_func(static_cast<int>(PyLogMessage::Level::CLEAR), file, lineno, "");
} else {
// this would clear all logging output in the console
runtime::detail::LogMessage(file, lineno, TVM_LOG_LEVEL_INFO).stream()
<< "\033c\033[3J\033[2J\033[0m\033[H";
if (const char* env_p = std::getenv("TVM_META_SCHEDULE_CLEAR_SCREEN")) {
if (std::string(env_p) == "1") {
if (logging_func.defined() && using_ipython()) {
logging_func(static_cast<int>(PyLogMessage::Level::CLEAR), file, lineno, "");
} else {
// this would clear all logging output in the console
runtime::detail::LogMessage(file, lineno, TVM_LOG_LEVEL_INFO).stream()
<< "\033c\033[3J\033[2J\033[0m\033[H";
}
}
}
}

Expand Down

0 comments on commit bf1be35

Please sign in to comment.