Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve federated init, validate reactor program, delimited proto messages #112

Merged
merged 19 commits into from
Nov 7, 2024

Conversation

erlingrj
Copy link
Collaborator

@erlingrj erlingrj commented Nov 2, 2024

This PR got a little fat...

  • Improve setup of connection. Now it is done in Environment at assemble. So no need to manually code that.
  • Fixed some small mistakes in TcpIpChannel receiving if multiple messages were there in the buffer
  • Use delimted serialize/deserialize
  • Fix a typo in posix examples
  • Add a function that validates that the program is correctly set up

Copy link
Contributor

github-actions bot commented Nov 2, 2024

Memory usage after merging this PR will be:

Memory Report

action_microstep_test_c

from to increase (%)
text 54417 57592 5.83
data 752 752 0.00
bss 480 480 0.00
total 55649 58824 5.71

action_test_c

from to increase (%)
text 54188 57363 5.86
data 752 752 0.00
bss 480 480 0.00
total 55420 58595 5.73

delayed_conn_test_c

from to increase (%)
text 54776 57919 5.74
data 744 744 0.00
bss 480 480 0.00
total 56000 59143 5.61

event_payload_pool_test_c

from to increase (%)
text 18297 18297 0.00
data 624 624 0.00
bss 320 320 0.00
total 19241 19241 0.00

event_queue_test_c

from to increase (%)
text 27239 27335 0.35
data 728 728 0.00
bss 480 480 0.00
total 28447 28543 0.34

nanopb_test_c

from to increase (%)
text 42884 42888 0.01
data 904 904 0.00
bss 320 320 0.00
total 44108 44112 0.01

physical_action_test_c

from to increase (%)
text 55381 58680 5.96
data 769 769 0.00
bss 10240 10240 0.00
total 66390 69689 4.97

port_test_c

from to increase (%)
text 54651 57794 5.75
data 744 744 0.00
bss 480 480 0.00
total 55875 59018 5.63

reaction_queue_test_c

from to increase (%)
text 26951 27047 0.36
data 728 728 0.00
bss 480 480 0.00
total 28159 28255 0.34

request_shutdown_test_c

from to increase (%)
text 54979 58154 5.77
data 744 744 0.00
bss 480 480 0.00
total 56203 59378 5.65

shutdown_test_c

from to increase (%)
text 51926 55101 6.11
data 752 752 0.00
bss 10912 10912 0.00
total 63590 66765 4.99

startup_test_c

from to increase (%)
text 51257 54432 6.19
data 752 752 0.00
bss 10688 10688 0.00
total 62697 65872 5.06

tcp_channel_test_c

from to increase (%)
text 58041 59387 2.32
data 1176 1176 0.00
bss 11072 11072 0.00
total 70289 71635 1.91

timer_test_c

from to increase (%)
text 51158 54333 6.21
data 744 744 0.00
bss 10720 10720 0.00
total 62622 65797 5.07

Copy link
Contributor

github-actions bot commented Nov 2, 2024

Memory usage after merging this PR will be:

Memory Report

action_microstep_test_c

from to increase (%)
text 54417 57592 5.83
data 752 752 0.00
bss 480 480 0.00
total 55649 58824 5.71

action_test_c

from to increase (%)
text 54188 57363 5.86
data 752 752 0.00
bss 480 480 0.00
total 55420 58595 5.73

delayed_conn_test_c

from to increase (%)
text 54776 57919 5.74
data 744 744 0.00
bss 480 480 0.00
total 56000 59143 5.61

event_payload_pool_test_c

from to increase (%)
text 18297 18297 0.00
data 624 624 0.00
bss 320 320 0.00
total 19241 19241 0.00

event_queue_test_c

from to increase (%)
text 27239 27335 0.35
data 728 728 0.00
bss 480 480 0.00
total 28447 28543 0.34

nanopb_test_c

from to increase (%)
text 42884 42888 0.01
data 904 904 0.00
bss 320 320 0.00
total 44108 44112 0.01

physical_action_test_c

from to increase (%)
text 55381 58680 5.96
data 769 769 0.00
bss 10240 10240 0.00
total 66390 69689 4.97

port_test_c

from to increase (%)
text 54651 57794 5.75
data 744 744 0.00
bss 480 480 0.00
total 55875 59018 5.63

reaction_queue_test_c

from to increase (%)
text 26951 27047 0.36
data 728 728 0.00
bss 480 480 0.00
total 28159 28255 0.34

request_shutdown_test_c

from to increase (%)
text 54979 58154 5.77
data 744 744 0.00
bss 480 480 0.00
total 56203 59378 5.65

shutdown_test_c

from to increase (%)
text 51926 55101 6.11
data 752 752 0.00
bss 10912 10912 0.00
total 63590 66765 4.99

startup_test_c

from to increase (%)
text 51257 54432 6.19
data 752 752 0.00
bss 10688 10688 0.00
total 62697 65872 5.06

tcp_channel_test_c

from to increase (%)
text 58041 59387 2.32
data 1176 1176 0.00
bss 11072 11072 0.00
total 70289 71635 1.91

timer_test_c

from to increase (%)
text 51158 54333 6.21
data 744 744 0.00
bss 10720 10720 0.00
total 62622 65797 5.07

src/environment.c Outdated Show resolved Hide resolved
@erlingrj
Copy link
Collaborator Author

erlingrj commented Nov 7, 2024

@LasseRosenow, I am here providing a initial implementation of your additions to the channel API. I think we should merge this soon before it gets too fat

Copy link
Contributor

github-actions bot commented Nov 7, 2024

Memory usage after merging this PR will be:

Memory Report

action_microstep_test_c

from to increase (%)
text 55244 58964 6.73
data 752 752 0.00
bss 480 480 0.00
total 56476 60196 6.59

action_overwrite_test_c

from to increase (%)
text 55092 58812 6.75
data 744 744 0.00
bss 480 480 0.00
total 56316 60036 6.61

action_test_c

from to increase (%)
text 55011 58731 6.76
data 752 752 0.00
bss 480 480 0.00
total 56243 59963 6.61

delayed_conn_test_c

from to increase (%)
text 54899 58587 6.72
data 744 744 0.00
bss 480 480 0.00
total 56123 59811 6.57

empty_action_test_c

from to increase (%)
text 54447 58147 6.80
data 752 752 0.00
bss 480 480 0.00
total 55679 59379 6.65

event_payload_pool_test_c

from to increase (%)
text 18330 18330 0.00
data 624 624 0.00
bss 320 320 0.00
total 19274 19274 0.00

event_queue_test_c

from to increase (%)
text 27329 27425 0.35
data 728 728 0.00
bss 480 480 0.00
total 28537 28633 0.34

multiple_startup_shutdown_test_c

from to increase (%)
text 53506 57226 6.95
data 744 744 0.00
bss 11360 11360 0.00
total 65610 69330 5.67

nanopb_test_c

from to increase (%)
text 42884 42888 0.01
data 904 904 0.00
bss 320 320 0.00
total 44108 44112 0.01

physical_action_test_c

from to increase (%)
text 56211 60055 6.84
data 769 769 0.00
bss 10240 10240 0.00
total 67220 71064 5.72

port_test_c

from to increase (%)
text 54774 58462 6.73
data 744 744 0.00
bss 480 480 0.00
total 55998 59686 6.59

reaction_queue_test_c

from to increase (%)
text 27041 27137 0.36
data 728 728 0.00
bss 480 480 0.00
total 28249 28345 0.34

request_shutdown_test_c

from to increase (%)
text 55966 59686 6.65
data 744 744 0.00
bss 480 480 0.00
total 57190 60910 6.50

shutdown_test_c

from to increase (%)
text 52049 55769 7.15
data 752 752 0.00
bss 10912 10912 0.00
total 63713 67433 5.84

startup_test_c

from to increase (%)
text 51380 55100 7.24
data 752 752 0.00
bss 10688 10688 0.00
total 62820 66540 5.92

tcp_channel_test_c

from to increase (%)
text 58043 59981 3.34
data 1176 1176 0.00
bss 11136 11136 0.00
total 70355 72293 2.75

timer_test_c

from to increase (%)
text 51281 55001 7.25
data 744 744 0.00
bss 10720 10720 0.00
total 62745 66465 5.93

@@ -41,6 +42,9 @@ void Environment_assemble(Environment *self) {
break;
case LF_IN_PROGRESS:
case LF_TRY_AGAIN:
if (chan->expected_try_connect_duration < wait_before_retry && chan->expected_try_connect_duration > 0) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Nice! This is what I was thinking also :)

@LasseRosenow
Copy link
Collaborator

Thank you for implementing the new NetworkChannelState enum for the TcpIpChannel. It looks good from what I can see.

Copy link
Contributor

github-actions bot commented Nov 7, 2024

Memory usage after merging this PR will be:

Memory Report

action_microstep_test_c

from to increase (%)
text 55244 58964 6.73
data 752 752 0.00
bss 480 480 0.00
total 56476 60196 6.59

action_overwrite_test_c

from to increase (%)
text 55092 58812 6.75
data 744 744 0.00
bss 480 480 0.00
total 56316 60036 6.61

action_test_c

from to increase (%)
text 55011 58731 6.76
data 752 752 0.00
bss 480 480 0.00
total 56243 59963 6.61

delayed_conn_test_c

from to increase (%)
text 54899 58587 6.72
data 744 744 0.00
bss 480 480 0.00
total 56123 59811 6.57

empty_action_test_c

from to increase (%)
text 54447 58147 6.80
data 752 752 0.00
bss 480 480 0.00
total 55679 59379 6.65

event_payload_pool_test_c

from to increase (%)
text 18330 18330 0.00
data 624 624 0.00
bss 320 320 0.00
total 19274 19274 0.00

event_queue_test_c

from to increase (%)
text 27329 27425 0.35
data 728 728 0.00
bss 480 480 0.00
total 28537 28633 0.34

multiple_startup_shutdown_test_c

from to increase (%)
text 53506 57226 6.95
data 744 744 0.00
bss 11360 11360 0.00
total 65610 69330 5.67

nanopb_test_c

from to increase (%)
text 42884 42888 0.01
data 904 904 0.00
bss 320 320 0.00
total 44108 44112 0.01

physical_action_test_c

from to increase (%)
text 56211 60055 6.84
data 769 769 0.00
bss 10240 10240 0.00
total 67220 71064 5.72

port_test_c

from to increase (%)
text 54774 58462 6.73
data 744 744 0.00
bss 480 480 0.00
total 55998 59686 6.59

reaction_queue_test_c

from to increase (%)
text 27041 27137 0.36
data 728 728 0.00
bss 480 480 0.00
total 28249 28345 0.34

request_shutdown_test_c

from to increase (%)
text 55966 59686 6.65
data 744 744 0.00
bss 480 480 0.00
total 57190 60910 6.50

shutdown_test_c

from to increase (%)
text 52049 55769 7.15
data 752 752 0.00
bss 10912 10912 0.00
total 63713 67433 5.84

startup_test_c

from to increase (%)
text 51380 55100 7.24
data 752 752 0.00
bss 10688 10688 0.00
total 62820 66540 5.92

tcp_channel_test_c

from to increase (%)
text 58043 59981 3.34
data 1176 1176 0.00
bss 11136 11136 0.00
total 70355 72293 2.75

timer_test_c

from to increase (%)
text 51281 55001 7.25
data 744 744 0.00
bss 10720 10720 0.00
total 62745 66465 5.93

Copy link
Contributor

github-actions bot commented Nov 7, 2024

Coverage after merging verify-setup into main will be

69.80%

Coverage Report
FileStmtsBranchesFuncsLinesUncovered Lines
src
   action.c90.20%84.62%100%91.67%24, 43–46, 49, 51, 53, 63–64
   builtin_triggers.c90.24%70%100%96.43%14, 18, 37, 40
   connection.c80.69%53.85%100%89.69%10, 101, 107, 11, 120–121, 133–134, 14, 14, 140, 142, 17–18, 18, 18–19, 21, 23–24, 29, 44, 47, 52, 57–59, 94
   environment.c61.76%45.45%76.92%65.56%10–11, 11, 11–12, 127–129, 14, 20, 22–27, 27, 27, 34–37, 37, 37–39, 39, 39, 39–43, 45, 45, 45, 45, 45–46, 48–51, 56–57, 79, 86–87, 9
   event.c95.35%92.86%100%96.15%14–15
   federated.c0%0%0%0%100–104, 106–108, 11, 111–113, 113, 113–114, 114, 114–116, 118, 12, 121–122, 124–128, 130–135, 137, 137, 137–139, 14, 140, 142, 142, 142–144, 144, 144–145, 149, 15, 150, 150, 150, 153–154, 158–159, 16, 160, 162, 162, 162, 164–168, 17, 171, 171, 171–174, 177–178, 178, 178–179, 181–182, 185–186, 19, 19, 19, 191–192, 192, 192–193, 195, 197, 197, 197–199, 20, 20, 20, 200, 200, 200, 200, 200–212, 216, 219, 219, 219, 22, 22, 22, 220–221, 225, 228–229, 229, 229, 229, 23, 230–237, 239, 24, 24, 24, 241–242, 244, 244, 244, 244, 244, 246, 246, 246–248, 25, 250, 252, 256–259, 26, 260–266, 268–269, 272–275, 277, 277, 277–278, 282–283, 283, 283, 285, 287–288, 288, 288–289, 289, 289–290, 290, 290–291, 291, 291–292, 292, 292, 294, 294, 294–295, 295, 295–296, 296, 296, 298, 30–31, 35–36, 38–41, 43, 45, 45, 45–46, 46, 46–47, 47, 47–48, 48, 48, 51–52, 54–57, 59, 59, 59–62, 64, 66–67, 67, 67, 67–71, 73–74, 78–79, 79, 79–80, 82–83, 85, 89–90, 92–94, 97, 99
   logging.c87.50%80%100%88.64%24, 37–39, 46, 59–60
   port.c90.91%58.33%100%100%10, 15, 19, 24–25
   queues.c91.12%82.14%100%95.05%107, 112, 118, 21–23, 46–47, 59–60, 83–87
   reaction.c90.41%75%100%97.78%18, 20, 24, 43–44, 54, 56
   reactor.c35.40%16.67%80%48.81%10, 10, 10, 108–109, 11–12, 12, 12–13, 13, 13–14, 14, 14–15, 15, 15–16, 16, 16–18, 18, 18–19, 19, 19, 22, 22, 22–24, 24, 24–25, 25, 25, 27, 27, 27–30, 30, 30–31, 31, 31–32, 32, 32–34, 34, 34–35, 35, 35, 39, 39, 39–42, 42, 42–43, 43, 43–44, 44, 44–46, 46, 46–47, 47, 47, 51, 51, 51–52, 52, 52–53, 55, 68–69, 69, 69–70, 8, 86, 9, 9, 9, 91–92, 92, 92–93
   scheduler.c81.79%67.05%94.12%87.02%102, 104, 104, 111, 125, 173, 176, 176, 176–179, 181–182, 182, 182–183, 203, 223–224, 230–232, 27, 276–277, 281, 285–286, 304, 31, 52–54, 54, 54–56, 56, 56, 58, 58, 58–59, 61–62, 62, 62–63, 69–72, 80–81, 85
   serialization.c50%50%50%50%16–17, 26–27, 33–35, 38–40
   tag.c40.19%31.48%60%47.92%14, 14–15, 17, 17–18, 23–24, 24, 24, 24, 24–25, 27, 27, 27, 27, 27–28, 30, 30, 30–31, 33–34, 34, 34–35, 37, 37, 37, 37, 37–38, 40, 40, 40, 40, 40–41, 43, 53–54, 63, 63–64, 83–85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85–87, 89
   timer.c94.59%66.67%100%100%14, 25
   trigger.c100%100%100%100%
src/platform/posix
   posix.c80.19%55.56%86.67%84.93%104, 16, 18, 20–21, 34–36, 38–40, 48–49, 62, 67, 76, 79, 92, 98
   tcp_ip_channel.c68.01%56.69%94.12%71.58%113–114, 119–120, 124–125, 144, 148, 148, 148, 152–153, 166–167, 170–171, 173, 173, 173, 175–176, 178–179, 186–187, 189, 192, 207, 212–213, 218–221, 224, 227, 230, 237–240, 242, 242, 242–244, 246–249, 252–253, 255, 283–285, 292, 297–299, 299, 299–300, 302–305, 31, 314, 314–316, 32, 338–341, 341, 341–343, 353–354, 354, 354–355, 355, 355–356, 360–361, 364, 374–375, 392–393, 397–398, 40–41, 412, 414, 421–422, 426–428, 455–456, 460–461,

@erlingrj erlingrj merged commit 9a3f83c into main Nov 7, 2024
6 checks passed
@erlingrj erlingrj deleted the verify-setup branch November 7, 2024 16:48
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