timer_list.h
Include dependency graph for timer_list.h:
![digraph {
graph [bgcolor="#00000000"]
node [shape=rectangle style=filled fillcolor="#FFFFFF" font=Helvetica padding=2]
edge [color="#1414CE"]
"2" [label="stdbool.h" tooltip="stdbool.h"]
"3" [label="stdint.h" tooltip="stdint.h"]
"1" [label="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/timer_list.h" tooltip="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/timer_list.h" fillcolor="#BFBFBF"]
"4" [label="list.h" tooltip="list.h"]
"1" -> "2" [dir=forward tooltip="include"]
"1" -> "3" [dir=forward tooltip="include"]
"1" -> "4" [dir=forward tooltip="include"]
"4" -> "2" [dir=forward tooltip="include"]
}](../../../_images/graphviz-eaa23d4eebbef7a840c5d1d7476f98f20117c8a9.png)
This graph shows which files directly or indirectly include timer_list.h:
![digraph {
graph [bgcolor="#00000000"]
node [shape=rectangle style=filled fillcolor="#FFFFFF" font=Helvetica padding=2]
edge [color="#1414CE"]
"4" [label="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/bif.c" tooltip="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/bif.c"]
"47" [label="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/dictionary.c" tooltip="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/dictionary.c"]
"3" [label="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/bif.h" tooltip="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/bif.h"]
"28" [label="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/platform_nifs.h" tooltip="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/platform_nifs.h"]
"15" [label="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/posix_nifs.c" tooltip="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/posix_nifs.c"]
"50" [label="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/posix_nifs.h" tooltip="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/posix_nifs.h"]
"46" [label="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/defaultatoms.h" tooltip="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/defaultatoms.h"]
"22" [label="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/inet.c" tooltip="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/inet.c"]
"21" [label="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/inet.h" tooltip="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/inet.h"]
"41" [label="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/scheduler.h" tooltip="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/scheduler.h"]
"7" [label="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/context.c" tooltip="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/context.c"]
"2" [label="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/context.h" tooltip="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/context.h"]
"39" [label="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/port.c" tooltip="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/port.c"]
"40" [label="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/port.h" tooltip="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/port.h"]
"18" [label="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/ets.c" tooltip="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/ets.c"]
"30" [label="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/stacktrace.c" tooltip="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/stacktrace.c"]
"29" [label="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/stacktrace.h" tooltip="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/stacktrace.h"]
"16" [label="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/refc_binary.c" tooltip="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/refc_binary.c"]
"42" [label="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/mailbox.c" tooltip="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/mailbox.c"]
"5" [label="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/module.c" tooltip="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/module.c"]
"27" [label="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/module.h" tooltip="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/module.h"]
"45" [label="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/avmpack.c" tooltip="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/avmpack.c"]
"44" [label="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/avmpack.h" tooltip="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/avmpack.h"]
"26" [label="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/term.c" tooltip="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/term.c"]
"24" [label="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/interop.c" tooltip="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/interop.c"]
"14" [label="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/otp_ssl.c" tooltip="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/otp_ssl.c"]
"20" [label="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/interop.h" tooltip="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/interop.h"]
"36" [label="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/otp_ssl.h" tooltip="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/otp_ssl.h"]
"38" [label="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/portnifloader.c" tooltip="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/portnifloader.c"]
"37" [label="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/portnifloader.h" tooltip="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/portnifloader.h"]
"17" [label="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/resources.c" tooltip="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/resources.c"]
"25" [label="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/otp_crypto.c" tooltip="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/otp_crypto.c"]
"33" [label="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/otp_crypto.h" tooltip="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/otp_crypto.h"]
"23" [label="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/otp_net.c" tooltip="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/otp_net.c"]
"49" [label="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/ets_hashtable.c" tooltip="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/ets_hashtable.c"]
"34" [label="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/otp_net.h" tooltip="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/otp_net.h"]
"48" [label="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/ets_hashtable.h" tooltip="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/ets_hashtable.h"]
"11" [label="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/erl_nif_priv.h" tooltip="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/erl_nif_priv.h"]
"31" [label="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/sys.h" tooltip="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/sys.h"]
"6" [label="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/nifs.c" tooltip="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/nifs.c"]
"32" [label="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/nifs.h" tooltip="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/nifs.h"]
"9" [label="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/debug.c" tooltip="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/debug.c"]
"8" [label="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/debug.h" tooltip="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/debug.h"]
"12" [label="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/globalcontext.c" tooltip="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/globalcontext.c"]
"43" [label="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/globalcontext.h" tooltip="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/globalcontext.h"]
"10" [label="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/memory.c" tooltip="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/memory.c"]
"13" [label="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/otp_socket.c" tooltip="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/otp_socket.c"]
"35" [label="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/otp_socket.h" tooltip="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/otp_socket.h"]
"51" [label="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/timer_list.c" tooltip="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/timer_list.c"]
"1" [label="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/timer_list.h" tooltip="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/timer_list.h" fillcolor="#BFBFBF"]
"19" [label="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/externalterm.c" tooltip="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/externalterm.c"]
"3" -> "4" [dir=back tooltip="include"]
"3" -> "5" [dir=back tooltip="include"]
"3" -> "6" [dir=back tooltip="include"]
"28" -> "6" [dir=back tooltip="include"]
"50" -> "12" [dir=back tooltip="include"]
"50" -> "6" [dir=back tooltip="include"]
"50" -> "13" [dir=back tooltip="include"]
"50" -> "15" [dir=back tooltip="include"]
"46" -> "4" [dir=back tooltip="include"]
"46" -> "47" [dir=back tooltip="include"]
"46" -> "18" [dir=back tooltip="include"]
"46" -> "12" [dir=back tooltip="include"]
"46" -> "24" [dir=back tooltip="include"]
"46" -> "6" [dir=back tooltip="include"]
"46" -> "25" [dir=back tooltip="include"]
"46" -> "23" [dir=back tooltip="include"]
"46" -> "13" [dir=back tooltip="include"]
"46" -> "14" [dir=back tooltip="include"]
"46" -> "39" [dir=back tooltip="include"]
"46" -> "40" [dir=back tooltip="include"]
"46" -> "15" [dir=back tooltip="include"]
"46" -> "17" [dir=back tooltip="include"]
"46" -> "30" [dir=back tooltip="include"]
"21" -> "22" [dir=back tooltip="include"]
"21" -> "23" [dir=back tooltip="include"]
"21" -> "13" [dir=back tooltip="include"]
"21" -> "14" [dir=back tooltip="include"]
"41" -> "12" [dir=back tooltip="include"]
"41" -> "42" [dir=back tooltip="include"]
"41" -> "6" [dir=back tooltip="include"]
"41" -> "13" [dir=back tooltip="include"]
"2" -> "3" [dir=back tooltip="include"]
"2" -> "7" [dir=back tooltip="include"]
"2" -> "8" [dir=back tooltip="include"]
"2" -> "11" [dir=back tooltip="include"]
"2" -> "18" [dir=back tooltip="include"]
"2" -> "19" [dir=back tooltip="include"]
"2" -> "12" [dir=back tooltip="include"]
"2" -> "20" [dir=back tooltip="include"]
"2" -> "10" [dir=back tooltip="include"]
"2" -> "5" [dir=back tooltip="include"]
"2" -> "27" [dir=back tooltip="include"]
"2" -> "6" [dir=back tooltip="include"]
"2" -> "32" [dir=back tooltip="include"]
"2" -> "25" [dir=back tooltip="include"]
"2" -> "23" [dir=back tooltip="include"]
"2" -> "13" [dir=back tooltip="include"]
"2" -> "14" [dir=back tooltip="include"]
"2" -> "39" [dir=back tooltip="include"]
"2" -> "40" [dir=back tooltip="include"]
"2" -> "37" [dir=back tooltip="include"]
"2" -> "16" [dir=back tooltip="include"]
"2" -> "17" [dir=back tooltip="include"]
"2" -> "41" [dir=back tooltip="include"]
"2" -> "29" [dir=back tooltip="include"]
"2" -> "26" [dir=back tooltip="include"]
"40" -> "22" [dir=back tooltip="include"]
"40" -> "6" [dir=back tooltip="include"]
"40" -> "23" [dir=back tooltip="include"]
"40" -> "13" [dir=back tooltip="include"]
"40" -> "14" [dir=back tooltip="include"]
"40" -> "39" [dir=back tooltip="include"]
"29" -> "30" [dir=back tooltip="include"]
"27" -> "3" [dir=back tooltip="include"]
"27" -> "5" [dir=back tooltip="include"]
"27" -> "6" [dir=back tooltip="include"]
"27" -> "28" [dir=back tooltip="include"]
"27" -> "29" [dir=back tooltip="include"]
"27" -> "31" [dir=back tooltip="include"]
"27" -> "26" [dir=back tooltip="include"]
"44" -> "45" [dir=back tooltip="include"]
"44" -> "12" [dir=back tooltip="include"]
"44" -> "6" [dir=back tooltip="include"]
"20" -> "21" [dir=back tooltip="include"]
"20" -> "24" [dir=back tooltip="include"]
"20" -> "6" [dir=back tooltip="include"]
"20" -> "25" [dir=back tooltip="include"]
"20" -> "23" [dir=back tooltip="include"]
"20" -> "13" [dir=back tooltip="include"]
"20" -> "14" [dir=back tooltip="include"]
"20" -> "15" [dir=back tooltip="include"]
"20" -> "26" [dir=back tooltip="include"]
"36" -> "14" [dir=back tooltip="include"]
"37" -> "38" [dir=back tooltip="include"]
"33" -> "25" [dir=back tooltip="include"]
"34" -> "23" [dir=back tooltip="include"]
"48" -> "18" [dir=back tooltip="include"]
"48" -> "49" [dir=back tooltip="include"]
"11" -> "7" [dir=back tooltip="include"]
"11" -> "12" [dir=back tooltip="include"]
"11" -> "10" [dir=back tooltip="include"]
"11" -> "13" [dir=back tooltip="include"]
"11" -> "14" [dir=back tooltip="include"]
"11" -> "15" [dir=back tooltip="include"]
"11" -> "16" [dir=back tooltip="include"]
"11" -> "17" [dir=back tooltip="include"]
"31" -> "7" [dir=back tooltip="include"]
"31" -> "12" [dir=back tooltip="include"]
"31" -> "5" [dir=back tooltip="include"]
"31" -> "6" [dir=back tooltip="include"]
"31" -> "13" [dir=back tooltip="include"]
"31" -> "17" [dir=back tooltip="include"]
"32" -> "5" [dir=back tooltip="include"]
"32" -> "6" [dir=back tooltip="include"]
"32" -> "25" [dir=back tooltip="include"]
"32" -> "33" [dir=back tooltip="include"]
"32" -> "23" [dir=back tooltip="include"]
"32" -> "34" [dir=back tooltip="include"]
"32" -> "13" [dir=back tooltip="include"]
"32" -> "35" [dir=back tooltip="include"]
"32" -> "14" [dir=back tooltip="include"]
"32" -> "36" [dir=back tooltip="include"]
"32" -> "37" [dir=back tooltip="include"]
"32" -> "15" [dir=back tooltip="include"]
"8" -> "9" [dir=back tooltip="include"]
"8" -> "10" [dir=back tooltip="include"]
"43" -> "44" [dir=back tooltip="include"]
"43" -> "7" [dir=back tooltip="include"]
"43" -> "2" [dir=back tooltip="include"]
"43" -> "46" [dir=back tooltip="include"]
"43" -> "48" [dir=back tooltip="include"]
"43" -> "12" [dir=back tooltip="include"]
"43" -> "10" [dir=back tooltip="include"]
"43" -> "5" [dir=back tooltip="include"]
"43" -> "27" [dir=back tooltip="include"]
"43" -> "6" [dir=back tooltip="include"]
"43" -> "25" [dir=back tooltip="include"]
"43" -> "23" [dir=back tooltip="include"]
"43" -> "34" [dir=back tooltip="include"]
"43" -> "13" [dir=back tooltip="include"]
"43" -> "35" [dir=back tooltip="include"]
"43" -> "14" [dir=back tooltip="include"]
"43" -> "36" [dir=back tooltip="include"]
"43" -> "39" [dir=back tooltip="include"]
"43" -> "40" [dir=back tooltip="include"]
"43" -> "37" [dir=back tooltip="include"]
"43" -> "15" [dir=back tooltip="include"]
"43" -> "50" [dir=back tooltip="include"]
"43" -> "41" [dir=back tooltip="include"]
"43" -> "30" [dir=back tooltip="include"]
"43" -> "31" [dir=back tooltip="include"]
"35" -> "13" [dir=back tooltip="include"]
"35" -> "14" [dir=back tooltip="include"]
"1" -> "2" [dir=back tooltip="include"]
"1" -> "43" [dir=back tooltip="include"]
"1" -> "51" [dir=back tooltip="include"]
}](../../../_images/graphviz-33033bb66361b82706d71f5ec03944b7d4142286.png)
Typedefs
- void() timer_list_callback_t (struct TimerListItem *)
Functions
-
static inline void timer_list_insert(struct TimerList *tw, struct TimerListItem *item)
-
static inline void timer_list_remove(struct TimerList *tw, struct TimerListItem *item)
-
static inline void timer_list_item_init(struct TimerListItem *it, uint64_t expiry)
-
void timer_list_next(struct TimerList *tw, uint64_t now, timer_list_callback_t cb)
process the timer wheel, calling cb for every item that should be fired (for which
expiry_time
<=now
).The current algorithm is very basic. Under heavy load, two processes scheduled for different timers might be triggered (same seems to be true with BEAM). The only optimization is the next time is saved so the function doesn’t run every timer on every call.
- Parameters:
tw – the timer wheel
now – the current monotonic date
cb – the callback
-
struct TimerList
- #include <timer_list.h>
Collaboration diagram for TimerList:
-
struct TimerListItem
- #include <timer_list.h>
Collaboration diagram for TimerListItem: