Feature Request: Preemption Visibility
Preemption Visibility. It would be great if we could have more hooks into preemption and reactivate-from-preemption events. Here are a couple ways that this information could be exposed:
- Each Process could "know" the history of its arrival time, preemption times, reactivate-from-preemption times, and finish time.
- Each Resource could maintain a list of arrival/preemption/finish times for tasks that execute on the Resource.
There could be a way to create events that signal when a preemption or reactivation happens, and the user can catalog the data that he/she wants.
Ideally, when looking at the preemption history for Process X, it should be clear which higher-priority Process Y is responsible for each preemption of Process X.
As discussed in this simpy-users thread (http://sourceforge.net/mailarchive/forum.php?thread_name=2114134.xqJWZDnfty%40bebop&forum_name=simpy-users), it's possible to obtain this data through SimulationTrace. However, using SimulationTrace just prints the trace without any data structures or anything. Alternatively, as Ontje Lünsdorf explained in the same thread, it's possible to use a function decorator to track preemptions, but I'm not sure if the decorator can also determine the identity of the higher priority Process Y that preempts a given Process X.
I'm not currently sure how to implement this.