haive.core.utils.debugkit.tracing.executionΒΆ

Code Tracing and Inspection Utilities

Provides powerful tracing capabilities for understanding code execution flow, function calls, variable changes, and performance bottlenecks.

ClassesΒΆ

CallTracker

Track function calls and execution flow.

TracingUtilities

Enhanced tracing utilities with multiple backends.

VariableTracker

Track variable changes during execution.

Module ContentsΒΆ

class haive.core.utils.debugkit.tracing.execution.CallTracker[source]ΒΆ

Track function calls and execution flow.

add_filter(pattern)[source]ΒΆ

Add a filter pattern for calls to track.

Parameters:

pattern (str)

Return type:

None

clear()[source]ΒΆ

Clear call history.

Return type:

None

disable()[source]ΒΆ

Disable call tracking.

Return type:

None

enable()[source]ΒΆ

Enable call tracking.

Return type:

None

get_stats()[source]ΒΆ

Get call statistics.

Return type:

dict[str, Any]

remove_filter(pattern)[source]ΒΆ

Remove a filter pattern.

Parameters:

pattern (str)

Return type:

None

should_track(function_name, filename)[source]ΒΆ

Check if a call should be tracked based on filters.

Parameters:
  • function_name (str)

  • filename (str)

Return type:

bool

track_call(func)[source]ΒΆ

Decorator to track function calls.

Parameters:

func (collections.abc.Callable)

Return type:

collections.abc.Callable

class haive.core.utils.debugkit.tracing.execution.TracingUtilities[source]ΒΆ

Enhanced tracing utilities with multiple backends.

calls(func=None, filters=None)[source]ΒΆ

Trace function calls.

Parameters:
Return type:

collections.abc.Callable

clear()[source]ΒΆ

Clear all tracing data.

Return type:

None

hunt(condition='call', **kwargs)[source]ΒΆ

Use hunter for advanced tracing if available.

Parameters:

condition (str)

Return type:

None

profile_calls(func)[source]ΒΆ

Profile function calls with detailed timing.

Parameters:

func (collections.abc.Callable)

Return type:

collections.abc.Callable

report(filename=None)[source]ΒΆ

Generate a comprehensive tracing report.

Parameters:

filename (str | None)

Return type:

str

snoop(func=None, **kwargs)[source]ΒΆ

Trace function execution with pysnooper if available.

Parameters:

func (collections.abc.Callable | None)

Return type:

collections.abc.Callable

stack(limit=None)[source]ΒΆ

Get formatted call stack.

Parameters:

limit (int | None)

Return type:

str

stats()[source]ΒΆ

Get comprehensive tracing statistics.

Return type:

dict[str, Any]

trace_context(name='trace')[source]ΒΆ

Context manager for tracing a block of code.

Parameters:

name (str)

vars(**kwargs)[source]ΒΆ

Track variable changes.

Return type:

None

class haive.core.utils.debugkit.tracing.execution.VariableTracker[source]ΒΆ

Track variable changes during execution.

clear()[source]ΒΆ

Clear tracking history.

Return type:

None

disable()[source]ΒΆ

Disable variable tracking.

Return type:

None

enable()[source]ΒΆ

Enable variable tracking.

Return type:

None

get_history(var_name=None)[source]ΒΆ

Get change history for a variable or all variables.

Parameters:

var_name (str | None)

Return type:

list[dict[str, Any]]

track(name, value)[source]ΒΆ

Track a variable change.

Parameters:
  • name (str)

  • value (Any)

Return type:

None