various: log memory events

Signed-off-by: NotAShelf <raf@notashelf.dev>
Change-Id: I6a6a69643b6d00277bb9bcfeb4cd01dc78d7cd3d
This commit is contained in:
raf 2025-09-30 20:11:06 +03:00
commit bc77b887ad
Signed by: NotAShelf
GPG key ID: 29D95B64378DB4BF
7 changed files with 280 additions and 47 deletions

15
include/chroma.h vendored
View file

@ -17,6 +17,13 @@
#define MAX_PATH_LEN 4096
#define CONFIG_FILE_NAME "chroma.conf"
// Log levels
#define CHROMA_LOG_ERROR 0
#define CHROMA_LOG_WARN 1
#define CHROMA_LOG_INFO 2
#define CHROMA_LOG_DEBUG 3
#define CHROMA_LOG_TRACE 4
// Error codes
typedef enum {
CHROMA_OK = 0,
@ -219,6 +226,14 @@ void chroma_sleep_ms(long ms);
void chroma_format_memory_size(size_t bytes, char *buffer, size_t buffer_size);
void chroma_utils_cleanup(void);
// Memory tracking and logging
void chroma_log_memory_stats(const char *context);
size_t chroma_get_memory_usage(void);
void chroma_log_resource_allocation(const char *resource_type, size_t size,
const char *description);
void chroma_log_resource_deallocation(const char *resource_type, size_t size,
const char *description);
// Listener structures
extern const struct wl_registry_listener chroma_registry_listener_impl;
extern const struct wl_output_listener chroma_output_listener_impl;