As quite of lot is ongoing under hood, you might sometimes be interested in what's actually happening. The C++ API provides a convenient interface to provide debugging output which describes what's happening. You can control what parts to see and which to be quiet about.
You need to include
which declares the debugging interface. Debug output can be retrieved for steps, tag-collections and item-collections by calling CnC::debug::trace
with the respective collections and a string constant which names the collections in the output. To trace our Fibonacci step and the item-collection you could issue the respective calls within the constructor of the context:
when running the program you will see a trace event for every step invocation and for every put/get of items. The trace includes annotations about the successful or unsuccessful completion of the traced operations.
Here is the full example code: fib_trace.cpp
Another interesting feature provides statistics about the internal scheduler. Depending on the availability of dependent items, a step might have been executed to early and needs being replayed when the missing item becomes available. The respective information can be printed when the context is destroyed (in our example when the program terminates). All you need to do is enabling this feature using CnC::debug::collect_scheduler_statistics
In the example fib_stats.cpp we have placed it into the context's constructor. Of course, it is possible to enable tracing and statistics gathering concurrently.
Next: The Tuner