PXL
config.hpp
Go to the documentation of this file.
1 // SPDX-License-Identifier: Apache-2.0
2 // Copyright 2024 XCENA Inc.
3 
4 #pragma once
5 
6 #include <cstddef>
7 #include <cstdint>
8 #include <initializer_list>
9 #include <pxl/log_types.hpp>
10 #include <pxl/v3_api_guard.hpp>
11 
12 namespace pxl
13 {
14 
15 // --- Logging ---
16 // LogType, LogLevel, LogDetail and LogOutput are in pxl/log_types.hpp.
17 
30 void enableLog(const LogType& type, const LogLevel& level = LogLevel::Error, const LogDetail& detail = LogDetail::None);
31 
42 void disableLog(const LogType& type);
43 
60 void setOutput(const LogOutput& outputType, const char* filename = nullptr);
61 
62 // --- Signal Handler ---
63 
86 void registerSignalHandler(int32_t signalType);
87 
101 void registerSignalHandler(const std::initializer_list<int32_t>& signalTypes);
102 
103 // --- Host Cache Flush ---
104 
142 void flushHostCache(void* hostVirtualPtr, size_t size, bool opt = true);
143 
196 void flushHostCacheUntracked(void* hostVirtualPtr, size_t size, bool opt = true);
197 
235 void invalidateHostCache(void* hostVirtualPtr, size_t size);
236 
237 } // namespace pxl
Definition: config.hpp:13
LogDetail
Definition: log_types.hpp:28
void enableLog(const LogType &type, const LogLevel &level=LogLevel::Error, const LogDetail &detail=LogDetail::None)
Configures logging settings for a specific log type.
void disableLog(const LogType &type)
Disables logging for a specific log type.
LogType
Definition: log_types.hpp:12
void invalidateHostCache(void *hostVirtualPtr, size_t size)
Drops host cache lines over the range so a later read sees what the device wrote.
LogLevel
Definition: log_types.hpp:21
void setOutput(const LogOutput &outputType, const char *filename=nullptr)
Sets the output destination for log messages.
void flushHostCacheUntracked(void *hostVirtualPtr, size_t size, bool opt=true)
Flushes the host CPU cache, and nothing else.
void registerSignalHandler(int32_t signalType)
Registers a signal handler for a specific signal type.
LogOutput
Definition: log_types.hpp:36
void flushHostCache(void *hostVirtualPtr, size_t size, bool opt=true)
Flushes the host CPU cache for the specified memory range and records the range as written.