lower fs reads during early warmboot
This commit is contained in:
1 parent
ba07273675
commit
85bfed0604
2 files changed
+2
-13
No files matched your search
@@ -46,7 +46,6 @@ namespace fileUtils {
|
|||||||
std::atomic_bool g_has_initialized = false;
|
std::atomic_bool g_has_initialized = false;
|
||||||
bool g_log_enabled = false;
|
bool g_log_enabled = false;
|
||||||
bool g_uart_enabled = false;
|
bool g_uart_enabled = false;
|
||||||
std::uint64_t g_last_flag_check = 0;
|
|
||||||
|
|
||||||
bool FlagExists(const char *path) {
|
bool FlagExists(const char *path) {
|
||||||
FILE *file = fopen(path, "r");
|
FILE *file = fopen(path, "r");
|
||||||
@@ -57,16 +56,9 @@ namespace fileUtils {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void RefreshFlags(bool force) {
|
void RefreshFlags() {
|
||||||
std::uint64_t now = armTicksToNs(armGetSystemTick());
|
|
||||||
if (!force && (now - g_last_flag_check) < FILE_FLAG_CHECK_INTERVAL_NS) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
g_log_enabled = FlagExists(FILE_LOG_FLAG_PATH);
|
g_log_enabled = FlagExists(FILE_LOG_FLAG_PATH);
|
||||||
g_uart_enabled = FlagExists(FILE_UART_FLAG_PATH);
|
g_uart_enabled = FlagExists(FILE_UART_FLAG_PATH);
|
||||||
|
|
||||||
g_last_flag_check = now;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void InitializeThreadFunc(void *args) {
|
void InitializeThreadFunc(void *args) {
|
||||||
@@ -94,8 +86,6 @@ namespace fileUtils {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
RefreshFlags(false);
|
|
||||||
|
|
||||||
if (!g_log_enabled && !g_uart_enabled) {
|
if (!g_log_enabled && !g_uart_enabled) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -223,7 +213,7 @@ namespace fileUtils {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (R_SUCCEEDED(rc)) {
|
if (R_SUCCEEDED(rc)) {
|
||||||
RefreshFlags(true);
|
RefreshFlags();
|
||||||
g_has_initialized = true;
|
g_has_initialized = true;
|
||||||
LogLine("=== hoc-clk " TARGET_VERSION " ===");
|
LogLine("=== hoc-clk " TARGET_VERSION " ===");
|
||||||
LogLine("by m4xw, natinusala, p-sam, Souldbminer, Lightos_ and Dominatorul");
|
LogLine("by m4xw, natinusala, p-sam, Souldbminer, Lightos_ and Dominatorul");
|
||||||
|
|||||||
@@ -35,7 +35,6 @@
|
|||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
#define FILE_CONFIG_DIR "/config/" CONFIG_DIR
|
#define FILE_CONFIG_DIR "/config/" CONFIG_DIR
|
||||||
#define FILE_FLAG_CHECK_INTERVAL_NS (10000ULL * 1000000000ULL)
|
|
||||||
#define FILE_CONTEXT_CSV_PATH FILE_CONFIG_DIR "/context.csv"
|
#define FILE_CONTEXT_CSV_PATH FILE_CONFIG_DIR "/context.csv"
|
||||||
#define FILE_LOG_FLAG_PATH FILE_CONFIG_DIR "/log.flag"
|
#define FILE_LOG_FLAG_PATH FILE_CONFIG_DIR "/log.flag"
|
||||||
#define FILE_UART_FLAG_PATH FILE_CONFIG_DIR "/uart.flag"
|
#define FILE_UART_FLAG_PATH FILE_CONFIG_DIR "/uart.flag"
|
||||||
|
|||||||
Reference in new issue
Block a user