kymo_core_trace.h File Reference
Application trace setup, instrumentation and diagnostics. More...
#include "kymo_types.h"Go to the source code of this file.
Classes | |
| struct | KymoCoreTraceConfig |
| Trace-only configuration for the default Core. More... | |
| class | KymoCoreTraceScope |
| Automatic C++ entry/exit instrumentation for one lexical scope. More... | |
Macros | |
| #define | KYMO_TRACE_FRAME_MAX 240u |
| Minimum Core TX capacity in bytes when Trace is initialized. | |
Typedefs | |
| typedef uint64_t(*) | KymoTraceClockTicksFn(void *pContext) |
| Read recorder ticks. | |
| typedef uint8_t(*) | KymoTraceCoreIdFn(void *pContext) |
| Read the current core index, below KYMO_TRACE_CORE_COUNT. | |
| typedef uint32_t(*) | KymoTraceCurrentContextFn(void *pContext) |
| Read the interrupted context ID for ISR entry; zero means unknown. | |
| typedef void(*) | KymoTraceCriticalFn(void *pContext) |
| Enter or exit the application synchronization primitive. | |
Functions | |
| KymoStatus | KymoCoreTrace_init (const KymoCoreTraceConfig *pConfig) |
| Initialize Trace and register it in Core Main. | |
| void | KymoCoreTrace_enter (uint32_t contextId, uint16_t symbolId) |
| Record function entry; symbolId must be nonzero. | |
| void | KymoCoreTrace_exit (uint32_t contextId, uint16_t symbolId) |
| Record matching function exit, including exits on error paths. | |
| void | KymoCoreTrace_mark (uint32_t contextId, uint16_t markerId, uint32_t value) |
| Record an application marker with an unsigned value. | |
| void | KymoCoreTrace_isrEnter (uint32_t irqContextId) |
| Record interrupt entry; synchronization must support this context. | |
| void | KymoCoreTrace_isrExit (uint32_t irqContextId) |
| Record interrupt exit matching the most recent entry. | |
| void | KymoCoreTrace_scheduler (uint32_t contextId, uint32_t taskId) |
| Record a switch to the selected task. | |
| void | KymoCoreTrace_taskCreate (uint32_t contextId, uint32_t generation) |
| Record creation of a context generation. | |
| void | KymoCoreTrace_taskEnd (uint32_t contextId, uint32_t generation) |
| Record completion of a context generation. | |
| void | KymoCoreTrace_coreState (uint32_t contextId, uint8_t state, uint8_t isRecovery) |
| Record core state: zero unknown, one running task, two idle; recovery is zero or one. | |
| void | KymoCoreTrace_flowSend (uint32_t contextId, uint16_t symbolId, uint32_t correlationId) |
| Record the send side of a correlated operation. | |
| void | KymoCoreTrace_flowReceive (uint32_t contextId, uint16_t symbolId, uint32_t correlationId) |
| Record the receive side of a correlated operation. | |
| KymoStatus | KymoCoreTrace_contextReset (uint32_t contextId, uint32_t generation) |
| Reset an inactive, fully unwound context to a new generation. | |
| uint32_t | KymoCoreTrace_dropCount (uint8_t coreId) |
| Read the dropped-event count for one core. | |
| uint8_t | KymoCoreTrace_isReady (void) |
| Test whether startup metadata and dictionary have reached TX. | |
Detailed Description
Application trace setup, instrumentation and diagnostics.
Core Main sends recorded events and metadata. Hooks only record events; call them at the desired locations. Before Init and after a Core fault they are inert. Serialize Core lifecycle with hooks. Lock callbacks protect recording, not Core lifecycle; ISR use requires appropriate locks and nonblocking callbacks.
- Usage Include this header, initialize Core and Trace, then enter/exit scopes.
Definition in file kymo_core_trace.h.
Macro Definition Documentation
◆ KYMO_TRACE_FRAME_MAX
| #define KYMO_TRACE_FRAME_MAX 240u |
Minimum Core TX capacity in bytes when Trace is initialized.
Definition at line 17 of file kymo_core_trace.h.
Typedef Documentation
◆ KymoTraceClockTicksFn
| typedef uint64_t(*) KymoTraceClockTicksFn(void *pContext) |
Read recorder ticks.
- Parameters
-
[in,out] pContext Application context supplied in the trace configuration.
- Returns
- Current clock or identifier value.
- Usage Supply a bounded implementation suitable for every recording context.
Definition at line 29 of file kymo_core_trace.h.
◆ KymoTraceCoreIdFn
| typedef uint8_t(*) KymoTraceCoreIdFn(void *pContext) |
Read the current core index, below KYMO_TRACE_CORE_COUNT.
- Parameters
-
[in,out] pContext Application context supplied in the trace configuration.
- Returns
- Current clock or identifier value.
- Usage Supply a bounded implementation suitable for every recording context.
Definition at line 37 of file kymo_core_trace.h.
◆ KymoTraceCriticalFn
| typedef void(*) KymoTraceCriticalFn(void *pContext) |
Enter or exit the application synchronization primitive.
- Parameters
-
[in,out] pContext Application context supplied in the trace configuration.
- Usage Supply a bounded implementation suitable for every recording context.
Definition at line 52 of file kymo_core_trace.h.
◆ KymoTraceCurrentContextFn
| typedef uint32_t(*) KymoTraceCurrentContextFn(void *pContext) |
Read the interrupted context ID for ISR entry; zero means unknown.
- Parameters
-
[in,out] pContext Application context supplied in the trace configuration.
- Returns
- Current clock or identifier value.
- Usage Supply a bounded implementation suitable for every recording context.
Definition at line 45 of file kymo_core_trace.h.
Function Documentation
◆ KymoCoreTrace_contextReset()
| KymoStatus KymoCoreTrace_contextReset | ( | uint32_t | contextId, |
| uint32_t | generation ) |
Reset an inactive, fully unwound context to a new generation.
- Parameters
-
[in] contextId Application context identifier; use a nonzero ID for scoped tracing. [in] generation Application context generation.
- Returns
- OK, BAD_CONFIG before initialization, or REJECTED while the context is active.
- Usage Call from an application context covered by the configured synchronization.
◆ KymoCoreTrace_coreState()
| void KymoCoreTrace_coreState | ( | uint32_t | contextId, |
| uint8_t | state, | ||
| uint8_t | isRecovery ) |
Record core state: zero unknown, one running task, two idle; recovery is zero or one.
- Parameters
-
[in] contextId Application context identifier; use a nonzero ID for scoped tracing. [in] state Core-state code described above. [in] isRecovery One for recovery, otherwise zero.
- Usage Call from an application context covered by the configured synchronization.
◆ KymoCoreTrace_dropCount()
| uint32_t KymoCoreTrace_dropCount | ( | uint8_t | coreId | ) |
Read the dropped-event count for one core.
- Parameters
-
[in] coreId Core index below KYMO_TRACE_CORE_COUNT.
- Returns
- Current count; zero before initialization or for an invalid core.
- Usage Call from an application context covered by the configured synchronization.
◆ KymoCoreTrace_enter()
| void KymoCoreTrace_enter | ( | uint32_t | contextId, |
| uint16_t | symbolId ) |
Record function entry; symbolId must be nonzero.
- Parameters
-
[in] contextId Application context identifier; use a nonzero ID for scoped tracing. [in] symbolId Nonzero generated symbol identifier.
- Usage Call from an application context covered by the configured synchronization.
◆ KymoCoreTrace_exit()
| void KymoCoreTrace_exit | ( | uint32_t | contextId, |
| uint16_t | symbolId ) |
Record matching function exit, including exits on error paths.
- Parameters
-
[in] contextId Application context identifier; use a nonzero ID for scoped tracing. [in] symbolId Nonzero generated symbol identifier.
- Usage Call from an application context covered by the configured synchronization.
◆ KymoCoreTrace_flowReceive()
| void KymoCoreTrace_flowReceive | ( | uint32_t | contextId, |
| uint16_t | symbolId, | ||
| uint32_t | correlationId ) |
Record the receive side of a correlated operation.
- Parameters
-
[in] contextId Application context identifier; use a nonzero ID for scoped tracing. [in] symbolId Nonzero generated symbol identifier. [in] correlationId Identifier matching the send and receive operations.
- Usage Call from an application context covered by the configured synchronization.
◆ KymoCoreTrace_flowSend()
| void KymoCoreTrace_flowSend | ( | uint32_t | contextId, |
| uint16_t | symbolId, | ||
| uint32_t | correlationId ) |
Record the send side of a correlated operation.
- Parameters
-
[in] contextId Application context identifier; use a nonzero ID for scoped tracing. [in] symbolId Nonzero generated symbol identifier. [in] correlationId Identifier matching the send and receive operations.
- Usage Call from an application context covered by the configured synchronization.
◆ KymoCoreTrace_init()
| KymoStatus KymoCoreTrace_init | ( | const KymoCoreTraceConfig * | pConfig | ) |
Initialize Trace and register it in Core Main.
Call once after Core Init and before the first Main. Setup errors latch a Core fault; late calls are rejected without changing a running Core.
- Parameters
-
[in] pConfig Trace settings; NULL is invalid.
- Returns
- OK, BAD_CONFIG, REJECTED, or the existing Core error.
- Usage Check success before calling instrumentation hooks. Not ISR-safe.
◆ KymoCoreTrace_isReady()
| uint8_t KymoCoreTrace_isReady | ( | void | ) |
Test whether startup metadata and dictionary have reached TX.
- Returns
- Nonzero when running and ready; zero before Init or after a fault.
- Usage Optional diagnostic; hooks can record before metadata completes.
◆ KymoCoreTrace_isrEnter()
| void KymoCoreTrace_isrEnter | ( | uint32_t | irqContextId | ) |
Record interrupt entry; synchronization must support this context.
- Parameters
-
[in] irqContextId Interrupt context identifier.
- Usage Call from an application context covered by the configured synchronization.
◆ KymoCoreTrace_isrExit()
| void KymoCoreTrace_isrExit | ( | uint32_t | irqContextId | ) |
Record interrupt exit matching the most recent entry.
- Parameters
-
[in] irqContextId Interrupt context identifier.
- Usage Call from an application context covered by the configured synchronization.
◆ KymoCoreTrace_mark()
| void KymoCoreTrace_mark | ( | uint32_t | contextId, |
| uint16_t | markerId, | ||
| uint32_t | value ) |
Record an application marker with an unsigned value.
- Parameters
-
[in] contextId Application context identifier; use a nonzero ID for scoped tracing. [in] markerId Nonzero generated marker identifier. [in] value Application value attached to the marker.
- Usage Call from an application context covered by the configured synchronization.
◆ KymoCoreTrace_scheduler()
| void KymoCoreTrace_scheduler | ( | uint32_t | contextId, |
| uint32_t | taskId ) |
Record a switch to the selected task.
- Parameters
-
[in] contextId Application context identifier; use a nonzero ID for scoped tracing. [in] taskId Identifier of the selected task.
- Usage Call from an application context covered by the configured synchronization.
◆ KymoCoreTrace_taskCreate()
| void KymoCoreTrace_taskCreate | ( | uint32_t | contextId, |
| uint32_t | generation ) |
Record creation of a context generation.
- Parameters
-
[in] contextId Application context identifier; use a nonzero ID for scoped tracing. [in] generation Application context generation.
- Usage Call from an application context covered by the configured synchronization.
◆ KymoCoreTrace_taskEnd()
| void KymoCoreTrace_taskEnd | ( | uint32_t | contextId, |
| uint32_t | generation ) |
Record completion of a context generation.
- Parameters
-
[in] contextId Application context identifier; use a nonzero ID for scoped tracing. [in] generation Application context generation.
- Usage Call from an application context covered by the configured synchronization.