ascii-chat
Binary v0.16.50-198-g78f51665f
Library lib/v0.3.2-2240-g78f51665f
Video chat in your terminal
Loading...
Searching...
No Matches
instrument_log.c File Reference

Debug instrumentation logging runtime implementation. More...

Go to the source code of this file.

Data Structures

struct  asciichat_instr_only_selector
 Selector for filtering instrumentation output by file, function, or module. More...
struct  asciichat_instr_only_list
 Dynamic array of instrumentation selectors for filtering output. More...
struct  asciichat_instr_runtime
 Per-thread instrumentation runtime state. More...

Macros

#define TOOLING_PANIC_INSTRUMENT_LOG_TIMESTAMP_BUFFER_SIZE   32
#define TOOLING_PANIC_INSTRUMENT_LOG_SNIPPET_BUFFER_SIZE   64
#define TOOLING_PANIC_INSTRUMENT_LOG_TID_BUFFER_SIZE   32
#define INSTRUMENT_LOG_KEY_BUFFER_SIZE   8
#define ASCII_INSTR_SOURCE_PRINT_HAVE_REGEX   1
#define posix_write   write
#define ASCII_INSTR_SOURCE_PRINT_DEFAULT_BASENAME   "ascii-instr"
#define ASCII_INSTR_SOURCE_PRINT_MAX_LINE   4096
#define ASCII_INSTR_SOURCE_PRINT_MAX_SNIPPET   2048

Typedefs

typedef enum asciichat_instr_selector_type asciichat_instr_selector_type_t
typedef struct asciichat_instr_only_selector asciichat_instr_only_selector_t
 Selector for filtering instrumentation output by file, function, or module.
typedef struct asciichat_instr_only_list asciichat_instr_only_list_t
 Dynamic array of instrumentation selectors for filtering output.
typedef struct asciichat_instr_runtime asciichat_instr_runtime_t
 Per-thread instrumentation runtime state.

Enumerations

enum  asciichat_instr_selector_type { ASCII_INSTR_SOURCE_PRINT_SELECTOR_FILE_SUBSTRING = 0 , ASCII_INSTR_SOURCE_PRINT_SELECTOR_FILE_GLOB = 1 , ASCII_INSTR_SOURCE_PRINT_SELECTOR_FUNCTION_GLOB = 2 , ASCII_INSTR_SOURCE_PRINT_SELECTOR_MODULE = 3 }

Functions

asciichat_instr_runtime_t * asciichat_instr_runtime_get (void)
 Get or create the thread-local runtime context.
void asciichat_instr_runtime_destroy (asciichat_instr_runtime_t *runtime)
 Destroy a runtime context and release resources.
void asciichat_instr_runtime_global_destroy (void)
 Global shutdown of the instrumentation system.
void asciichat_instr_log_line (const char *file_path, uint32_t line_number, const char *function_name, const char *snippet, uint8_t is_macro_expansion)
 Log a source line execution event.
bool asciichat_instr_coverage_enabled (void)
 Check if coverage logging is enabled.
void asciichat_instr_log_pc (uintptr_t program_counter)
 Log a program counter for coverage analysis.

Detailed Description

Debug instrumentation logging runtime implementation.

Implements the runtime logging infrastructure for source-code instrumentation. Captures execution traces with filtering, rate limiting, and coverage analysis. See include/ascii-chat/tooling/panic/instrument_log.h for the public API.

Definition in file instrument_log.c.

Macro Definition Documentation

◆ ASCII_INSTR_SOURCE_PRINT_DEFAULT_BASENAME

#define ASCII_INSTR_SOURCE_PRINT_DEFAULT_BASENAME   "ascii-instr"

Definition at line 77 of file instrument_log.c.

◆ ASCII_INSTR_SOURCE_PRINT_HAVE_REGEX

#define ASCII_INSTR_SOURCE_PRINT_HAVE_REGEX   1

Definition at line 54 of file instrument_log.c.

◆ ASCII_INSTR_SOURCE_PRINT_MAX_LINE

#define ASCII_INSTR_SOURCE_PRINT_MAX_LINE   4096

Definition at line 81 of file instrument_log.c.

Referenced by asciichat_instr_log_line().

◆ ASCII_INSTR_SOURCE_PRINT_MAX_SNIPPET

#define ASCII_INSTR_SOURCE_PRINT_MAX_SNIPPET   2048

Definition at line 85 of file instrument_log.c.

Referenced by asciichat_instr_log_line().

◆ INSTRUMENT_LOG_KEY_BUFFER_SIZE

#define INSTRUMENT_LOG_KEY_BUFFER_SIZE   8

Definition at line 20 of file instrument_log.c.

◆ posix_write

#define posix_write   write

Definition at line 73 of file instrument_log.c.

Referenced by asciichat_instr_log_line().

◆ TOOLING_PANIC_INSTRUMENT_LOG_SNIPPET_BUFFER_SIZE

#define TOOLING_PANIC_INSTRUMENT_LOG_SNIPPET_BUFFER_SIZE   64

Definition at line 16 of file instrument_log.c.

Referenced by asciichat_instr_log_pc().

◆ TOOLING_PANIC_INSTRUMENT_LOG_TID_BUFFER_SIZE

#define TOOLING_PANIC_INSTRUMENT_LOG_TID_BUFFER_SIZE   32

Definition at line 17 of file instrument_log.c.

◆ TOOLING_PANIC_INSTRUMENT_LOG_TIMESTAMP_BUFFER_SIZE

#define TOOLING_PANIC_INSTRUMENT_LOG_TIMESTAMP_BUFFER_SIZE   32

Definition at line 15 of file instrument_log.c.

Referenced by asciichat_instr_log_line().

Typedef Documentation

◆ asciichat_instr_only_list_t

Dynamic array of instrumentation selectors for filtering output.

◆ asciichat_instr_only_selector_t

Selector for filtering instrumentation output by file, function, or module.

Dynamic array of instrumentation selectors for filtering output

asciichat instr runtime keeps the values that move through the subsystem: fd, pid, thread_id, sequence. Some members are pointers into caller- or subsystem-owned memory, so lifetime follows the API that populated them rather than the struct copy itself.

Selector for filtering instrumentation output by file, function, or module

◆ asciichat_instr_selector_type_t

Enumeration Type Documentation

◆ asciichat_instr_selector_type

Enumerator
ASCII_INSTR_SOURCE_PRINT_SELECTOR_FILE_SUBSTRING 
ASCII_INSTR_SOURCE_PRINT_SELECTOR_FILE_GLOB 
ASCII_INSTR_SOURCE_PRINT_SELECTOR_FUNCTION_GLOB 
ASCII_INSTR_SOURCE_PRINT_SELECTOR_MODULE 

Definition at line 88 of file instrument_log.c.

88 {
@ ASCII_INSTR_SOURCE_PRINT_SELECTOR_FUNCTION_GLOB
@ ASCII_INSTR_SOURCE_PRINT_SELECTOR_FILE_GLOB
@ ASCII_INSTR_SOURCE_PRINT_SELECTOR_FILE_SUBSTRING
@ ASCII_INSTR_SOURCE_PRINT_SELECTOR_MODULE
enum asciichat_instr_selector_type asciichat_instr_selector_type_t