Hi dear friends.
I'd love getting your input on an additional related algorithm.
The user would like to be notified also when density of the Events is above 50% (with at least 6 events).
The Event can happen every time a certain Module is activated - if the event (interrupt) happens, it'd happen ~1ms after the module was activated.
Therefore, When the Module is activated 10 times, and the Event occurred 6 times, the user would like to be notified: E.G.
Module Activation: .......................................... 1--2--3--
4---5--6---7--8---9--10--11-12-13-14-15
Event Occurred (Y) / Not Occurred (N): .............. N, N, N,
Y , N , Y , N , Y , N , Y , N , Y , Y, N, N
At the above Example, the user should be notified when the Event occurred at the 13th Activation, since if you start gathering statistics from #4 to #13, you'll see 6 Events occurred out of 10 Module Activations = i.e. 60% density with at least 6 Events.
The Inputs I have are:
- When a Module is activated
- When an Event (interrupt) happens (which, if happens, it'd happens ~1ms after the Module was activated)
How would you handle the counting?
My main dilemma is, when to Reset the Events-Counter and Module-Activation Counter?
I know that I should start counting only when the 1st Event occurs.
I'd love hearing your ideas
Thank you.