CBD.tracers package

The tracers module provides an interface for tracing simulation data.

class CBD.tracers.Tracers(sim)[source]

Bases: object

Collection object for multiple tracers.

Parameters

sim (Simulator) – The CBD simulator of the trace object.

Note

This class will maintain and keep track of the UID of a tracer. Don’t set this yourself!

hasTracers()[source]

Checks that there are registered tracers.

thread_loop()[source]

Mainloop for tracing information. reduces the amount of threads created.

trace(event, args)[source]

Traces an event. :param event: The event to trace. :type event: callable :param args: The list of arguments for the event. :type args: iter

registerTracer(tracer, recover=False)[source]

Registers a specific tracer to use.

Parameters
  • tracer – Either a tuple of (file, classname, [args]), similar to PythonPDEVS; or an instance of a subclass of CBD.tracers.baseTracer.BaseTracer.

  • recover (bool) – Whether or not this is a recovered registration; i.e. whether or not the trace file should be appended. Defaults to False.

deregisterTracer(uid)[source]

Stops and removes a specific tracer.

Parameters

uid (int) – The tracer id to stop.

stopTracers()[source]

Stops all tracers.

getById(uid)[source]

Obtains a specific tracer.

Parameters

uid (int) – The tracer id to obtain.

Raises

ValueError – If the tracer does not exist.

traceNewIteration(curIt, time)[source]

Traces a new iteration start.

Parameters
  • curIt (int) – The current iteration.

  • time (numeric) – The current simulation time.

traceCompute(curIteration, block)[source]

Traces the computation of a specific block.

Parameters
  • curIteration (int) – The current iteration.

  • block (CBD.Core.BaseBlock) – The block for which a compute just happened.

Submodules