You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Besides for some debugging purposes, (such as seeing how many ticks occurring before my other code wakes the socket up again), this would also be useful for the Machine to be able to notify a user if they are doing blocking work, or otherwise too much work, in the ready event. One could observe the time difference between ticks, and above a threshold, act accordingly.
The text was updated successfully, but these errors were encountered:
Well, I'm okay with exposing tick, but I'm not sure about the API's. There are now global events in rotor yet. But for your use case:
this would also be useful for the Machine to be able to notify a user if they are doing blocking work, or otherwise too much work, in the ready event. One could observe the time difference between ticks, and above a threshold, act accordingly.
The tick event is inherently global (for all state machines). To observe ready events for your state machine you may just write a wrapper type:
struct TickMeasure<M>(M);
impl<M> Machine for TickMeasure<M> {
fn ready(...) {
let tm = get_time();
let res = self.0.ready(...);
println!("time {:?}", get_time() - tm);
return res;
}
}
Then you can wrap any state machine into this type. Surely, you can wrap every state machine with it, just measurements will be individual (comparing to EventLoop::tick())
You can also submit a pull request to rotor-tools if you think such utility is generally useful.
Besides for some debugging purposes, (such as seeing how many ticks occurring before my other code wakes the socket up again), this would also be useful for the Machine to be able to notify a user if they are doing blocking work, or otherwise too much work, in the ready event. One could observe the time difference between ticks, and above a threshold, act accordingly.
The text was updated successfully, but these errors were encountered: