2017-12-21 07:45:38 +08:00
|
|
|
/*
|
2021-05-17 02:51:16 +08:00
|
|
|
* Copyright (C) 2018-2021 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"
|
|
|
|
#include "shared/source/utilities/debug_settings_reader.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() {
|
|
|
|
debugVarSnapshot = DebugManager.flags;
|
|
|
|
injectFcnSnapshot = DebugManager.injectFcn;
|
|
|
|
}
|
|
|
|
~DebugManagerStateRestore() {
|
|
|
|
DebugManager.flags = debugVarSnapshot;
|
|
|
|
DebugManager.injectFcn = injectFcnSnapshot;
|
2018-11-23 16:43:06 +08:00
|
|
|
#undef DECLARE_DEBUG_VARIABLE
|
|
|
|
#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
|
|
|
};
|
|
|
|
|
|
|
|
class RegistryReaderMock : public SettingsReader {
|
|
|
|
public:
|
|
|
|
RegistryReaderMock() {}
|
2019-11-20 19:23:06 +08:00
|
|
|
~RegistryReaderMock() override {}
|
2017-12-21 07:45:38 +08:00
|
|
|
|
2020-03-27 14:47:16 +08:00
|
|
|
uint64_t forceRetValue = 1;
|
2017-12-21 07:45:38 +08:00
|
|
|
|
|
|
|
int32_t getSetting(const char *settingName, int32_t defaultValue) override {
|
2020-03-27 14:47:16 +08:00
|
|
|
return static_cast<uint32_t>(forceRetValue);
|
2017-12-21 07:45:38 +08:00
|
|
|
}
|
2020-03-27 14:47:16 +08:00
|
|
|
|
|
|
|
int64_t getSetting(const char *settingName, int64_t defaultValue) override {
|
|
|
|
return forceRetValue;
|
|
|
|
}
|
|
|
|
|
2017-12-21 07:45:38 +08:00
|
|
|
bool getSetting(const char *settingName, bool defaultValue) override {
|
|
|
|
return true;
|
|
|
|
}
|
2018-10-10 22:02:19 +08:00
|
|
|
|
2017-12-21 07:45:38 +08:00
|
|
|
std::string getSetting(const char *settingName, const std::string &value) override {
|
|
|
|
return "";
|
|
|
|
}
|
2020-03-27 14:47:16 +08:00
|
|
|
|
2018-10-10 22:02:19 +08:00
|
|
|
const char *appSpecificLocation(const std::string &name) override {
|
|
|
|
return name.c_str();
|
|
|
|
}
|
2017-12-21 07:45:38 +08:00
|
|
|
};
|