Skip to content

evtimer: add peek functionality to look into future#19

Closed
miri64 wants to merge 3 commits intokaspar030:evtimerfrom
miri64:evtimer/feat/init
Closed

evtimer: add peek functionality to look into future#19
miri64 wants to merge 3 commits intokaspar030:evtimerfrom
miri64:evtimer/feat/init

Conversation

@miri64
Copy link
Copy Markdown

@miri64 miri64 commented Oct 24, 2016

Will return true, if peek_cb returns true for any event currently
scheduled.

I also added some wrappers for evtimer_msg_event_t to have it similar easy to understand like xtimer_send_msg().

evtimer->events = NULL;
}

#if ENABLE_DEBUG == 1
Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Due to this you will get link errors, if called externally, but ENABLE_DEBUG here is 0.

@miri64
Copy link
Copy Markdown
Author

miri64 commented Oct 24, 2016

Added context capabilities to the peek context so one does not need to implement callbacks for every event type if there are multiple.

@kaspar030
Copy link
Copy Markdown
Owner

Especially if you want to "peek" into the future for a certain kind of event, this might be necessary.

I'm not sure peeking into the timers list is a good idea.

Your use-case is "send RA only if next RA is more than X time away (or not scheduled)", right?
Having to traverse the timer list for every single peek seems too expensive.

@miri64
Copy link
Copy Markdown
Author

miri64 commented Oct 27, 2016

Your use-case is "send RA only if next RA is more than X time away (or not scheduled)", right?

It's even a little bit more complicated I realized. It's more like: if between 0 and X time units no NS is scheduled send now, if between X and 2X time units no NS is scheduled send in t

Having to traverse the timer list for every single peek seems too expensive.

More expensive then broadcasting unnecessary messages?

@kaspar030
Copy link
Copy Markdown
Owner

Having to traverse the timer list for every single peek seems too expensive.
More expensive then broadcasting unnecessary messages?

More expensive than thinking a little bit on what you want to achieve.
Your requirement is not "look at the list of scheduled NS in order to find out whether to send now or in t".
How many NS are scheduled at any time? If the answer is zero or one (per peer/iface/whatever), just save the time of that in a struct of your choice.

@miri64
Copy link
Copy Markdown
Author

miri64 commented Oct 27, 2016

How many NS are scheduled at any time? If the answer is zero or one (per peer/iface/whatever), just save the time of that in a struct of your choice.

<=3 multicast (per interface) when an unknown neighbor is to be resolved, <=3 unicast for any known neighbor when NUD is performed. Also rate-limited are multicast RAs and multicast NAs (both per interface). For a scalable network that's a lot of 32-bit numbers (in typically scarcer RAM) to save some bytes in ROM considering that the time is already saved in this event queue.

Will return true, if `peek_cb` returns true for any event currently
scheduled
@miri64 miri64 force-pushed the evtimer/feat/init branch from 8ac633c to 757c52a Compare October 27, 2016 09:43
@miri64
Copy link
Copy Markdown
Author

miri64 commented Oct 27, 2016

Rebased.

@kaspar030
Copy link
Copy Markdown
Owner

<=3 multicast (per interface) when an unknown neighbor is to be resolved, <=3 unicast for any known neighbor when NUD is performed. Also rate-limited are multicast RAs and multicast NAs (both per interface). For a scalable network that's a lot of 32-bit numbers (in typically scarcer RAM) to save some bytes in ROM considering that the time is already saved in this event queue.

So you're scheduling all of them at once? Why not schedule one event to trigger the first and when it get's sent, schedule the next?

@miri64
Copy link
Copy Markdown
Author

miri64 commented Oct 27, 2016

So you're scheduling all of them at once? Why not schedule one event to trigger the first and when it get's sent, schedule the next?

You mean the messages of same type or in general?

@kaspar030
Copy link
Copy Markdown
Owner

Every neighbor gets solicitations, right? And every interface gets RS. So now with N neighbors, you could schedule N*M (M<=3) solicitation packets (which was your original plan the way I read your use-case).
Or you could, per neighbor, schedule only the next NS and a count how many you've already sent. Same for each interface with router solicitations. That way you'd have to save two integers and one timer per peer/interface/..., which is already less than >=2 timers per peer/interface/...

@kaspar030
Copy link
Copy Markdown
Owner

schedule only the next NS and a count how many you've already sent.

Sorry, I mean, schedule the next, and remember when that should trigger and how many you've already sent.

@kaspar030
Copy link
Copy Markdown
Owner

I've merged the uncrustify, milliseconds, ENABLE_DEBUG, casting fixes.

@miri64
Copy link
Copy Markdown
Author

miri64 commented Oct 27, 2016

Every neighbor gets solicitations, right? And every interface gets RS. So now with N neighbors, you could schedule N*M (M<=3) solicitation packets (which was your original plan the way I read your use-case).
Or you could, per neighbor, schedule only the next NS and a count how many you've already sent. Same for each interface with router solicitations. That way you'd have to save two integers and one timer per peer/interface/..., which is already less than >=2 timers per peer/interface/...

No sorry that was really confusingly stated by me: of course I will only schedule the next NS. Let me think about (and try out) your proposal first.

@miri64 miri64 closed this Jan 6, 2017
@miri64 miri64 deleted the evtimer/feat/init branch January 6, 2017 12:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants