2017-12-21 07:45:38 +08:00
|
|
|
/*
|
2023-11-30 16:32:25 +08:00
|
|
|
* Copyright (C) 2018-2023 Intel Corporation
|
2017-12-21 07:45:38 +08:00
|
|
|
*
|
2018-11-23 16:43:06 +08:00
|
|
|
* SPDX-License-Identifier: MIT
|
2017-12-21 07:45:38 +08:00
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
#pragma once
|
2020-02-24 05:44:01 +08:00
|
|
|
#include "shared/source/debug_settings/debug_settings_manager.h"
|
2017-12-21 07:45:38 +08:00
|
|
|
|
2019-03-26 18:59:46 +08:00
|
|
|
using namespace NEO;
|
2017-12-21 07:45:38 +08:00
|
|
|
|
|
|
|
class DebugManagerStateRestore {
|
|
|
|
public:
|
|
|
|
DebugManagerStateRestore() {
|
2023-11-30 16:32:25 +08:00
|
|
|
debugVarSnapshot = debugManager.flags;
|
|
|
|
injectFcnSnapshot = debugManager.injectFcn;
|
2017-12-21 07:45:38 +08:00
|
|
|
}
|
|
|
|
~DebugManagerStateRestore() {
|
2023-11-30 16:32:25 +08:00
|
|
|
debugManager.flags = debugVarSnapshot;
|
|
|
|
debugManager.injectFcn = injectFcnSnapshot;
|
2018-11-23 16:43:06 +08:00
|
|
|
#undef DECLARE_DEBUG_VARIABLE
|
2023-11-30 16:32:25 +08:00
|
|
|
#define DECLARE_DEBUG_VARIABLE(dataType, variableName, defaultValue, description) shrink(debugManager.flags.variableName.getRef());
|
2020-06-15 17:16:46 +08:00
|
|
|
#include "shared/source/debug_settings/release_variables.inl"
|
|
|
|
|
2018-11-23 16:43:06 +08:00
|
|
|
#include "debug_variables.inl"
|
|
|
|
#undef DECLARE_DEBUG_VARIABLE
|
2017-12-21 07:45:38 +08:00
|
|
|
}
|
2019-01-19 08:40:42 +08:00
|
|
|
DebugVariables debugVarSnapshot;
|
2017-12-21 07:45:38 +08:00
|
|
|
void *injectFcnSnapshot = nullptr;
|
2018-11-23 16:43:06 +08:00
|
|
|
|
|
|
|
protected:
|
|
|
|
void shrink(std::string &flag) {
|
|
|
|
flag.shrink_to_fit();
|
|
|
|
}
|
2020-03-27 14:47:16 +08:00
|
|
|
void shrink(int64_t &flag) {}
|
2018-11-23 16:43:06 +08:00
|
|
|
void shrink(int32_t &flag) {}
|
|
|
|
void shrink(bool &flag) {}
|
2017-12-21 07:45:38 +08:00
|
|
|
};
|