From a5889b9aad9afc13480c74485e152f592c761446 Mon Sep 17 00:00:00 2001 From: Andrew Kaster Date: Sun, 25 Apr 2021 19:28:37 -0600 Subject: [PATCH] Shell: Hide job times behind SHELL_JOB_DEBUG flag --- AK/Debug.h.in | 4 ++++ Meta/CMake/all_the_debug_macros.cmake | 1 + Userland/Shell/Job.h | 18 +++++++----------- 3 files changed, 12 insertions(+), 11 deletions(-) diff --git a/AK/Debug.h.in b/AK/Debug.h.in index d816baa4e9..ee1a9311c8 100644 --- a/AK/Debug.h.in +++ b/AK/Debug.h.in @@ -350,6 +350,10 @@ #cmakedefine01 SH_LANGUAGE_SERVER_DEBUG #endif +#ifndef SHELL_JOB_DEBUG +#cmakedefine01 SHELL_JOB_DEBUG +#endif + #ifndef SOLITAIRE_DEBUG #cmakedefine01 SOLITAIRE_DEBUG #endif diff --git a/Meta/CMake/all_the_debug_macros.cmake b/Meta/CMake/all_the_debug_macros.cmake index caf4655dcc..d9480516f1 100644 --- a/Meta/CMake/all_the_debug_macros.cmake +++ b/Meta/CMake/all_the_debug_macros.cmake @@ -57,6 +57,7 @@ set(CRYPTO_DEBUG ON) set(DWARF_DEBUG ON) set(HUNKS_DEBUG ON) set(JOB_DEBUG ON) +set(SHELL_JOB_DEBUG ON) set(GIF_DEBUG ON) set(JPG_DEBUG ON) set(EMOJI_DEBUG ON) diff --git a/Userland/Shell/Job.h b/Userland/Shell/Job.h index 6d8acecf4f..f2a579fbf6 100644 --- a/Userland/Shell/Job.h +++ b/Userland/Shell/Job.h @@ -8,6 +8,7 @@ #include "Execution.h" #include "Forward.h" +#include #include #include #include @@ -16,11 +17,6 @@ #include #include -#define JOB_TIME_INFO -#ifndef __serenity__ -# undef JOB_TIME_INFO -#endif - namespace Shell { struct LocalFrame; @@ -31,13 +27,13 @@ public: ~Job() { -#ifdef JOB_TIME_INFO - if (m_active) { - auto elapsed = m_command_timer.elapsed(); - // Don't mistake this for the command! - dbgln("Job entry '{}' deleted in {} ms", m_cmd, elapsed); + if constexpr (SHELL_JOB_DEBUG) { + if (m_active) { + auto elapsed = m_command_timer.elapsed(); + // Don't mistake this for the command! + dbgln("Job entry '{}' deleted in {} ms", m_cmd, elapsed); + } } -#endif } Function)> on_exit;