Shell: Hide job times behind SHELL_JOB_DEBUG flag

This commit is contained in:
Andrew Kaster 2021-04-25 19:28:37 -06:00 committed by Ali Mohammad Pur
parent 0d0f52337c
commit a5889b9aad
Notes: sideshowbarker 2024-07-18 17:38:42 +09:00
3 changed files with 12 additions and 11 deletions

View File

@ -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

View File

@ -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)

View File

@ -8,6 +8,7 @@
#include "Execution.h"
#include "Forward.h"
#include <AK/Debug.h>
#include <AK/Function.h>
#include <AK/JsonObject.h>
#include <AK/JsonValue.h>
@ -16,11 +17,6 @@
#include <LibCore/ElapsedTimer.h>
#include <LibCore/Object.h>
#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<void(RefPtr<Job>)> on_exit;