@@ -3107,6 +3107,27 @@ pub mod api {
31073107 }
31083108 #[ derive( Clone , Debug ) ]
31093109 #[ non_exhaustive]
3110+ #[ doc = " Emitted for each receive socket with per-socket packet counts" ]
3111+ pub struct PlatformRxSocketStats {
3112+ #[ doc = " Whether this socket is the prioritized socket" ]
3113+ pub is_prioritized : bool ,
3114+ #[ doc = " The number of packets received on this socket since the last event" ]
3115+ pub count : usize ,
3116+ }
3117+ #[ cfg( any( test, feature = "testing" ) ) ]
3118+ impl crate :: event:: snapshot:: Fmt for PlatformRxSocketStats {
3119+ fn fmt ( & self , fmt : & mut core:: fmt:: Formatter ) -> core:: fmt:: Result {
3120+ let mut fmt = fmt. debug_struct ( "PlatformRxSocketStats" ) ;
3121+ fmt. field ( "is_prioritized" , & self . is_prioritized ) ;
3122+ fmt. field ( "count" , & self . count ) ;
3123+ fmt. finish ( )
3124+ }
3125+ }
3126+ impl Event for PlatformRxSocketStats {
3127+ const NAME : & ' static str = "platform:rx_socket" ;
3128+ }
3129+ #[ derive( Clone , Debug ) ]
3130+ #[ non_exhaustive]
31103131 pub struct PlatformEventLoopWakeup {
31113132 pub timeout_expired : bool ,
31123133 pub rx_ready : bool ,
@@ -4576,6 +4597,19 @@ pub mod tracing {
45764597 tracing :: event ! ( target : "platform_feature_configured" , parent : parent , tracing :: Level :: DEBUG , { configuration = tracing :: field :: debug ( configuration) } ) ;
45774598 }
45784599 #[ inline]
4600+ fn on_platform_rx_socket_stats (
4601+ & mut self ,
4602+ meta : & api:: EndpointMeta ,
4603+ event : & api:: PlatformRxSocketStats ,
4604+ ) {
4605+ let parent = self . parent ( meta) ;
4606+ let api:: PlatformRxSocketStats {
4607+ is_prioritized,
4608+ count,
4609+ } = event;
4610+ tracing :: event ! ( target : "platform_rx_socket_stats" , parent : parent , tracing :: Level :: DEBUG , { is_prioritized = tracing :: field :: debug ( is_prioritized) , count = tracing :: field :: debug ( count) } ) ;
4611+ }
4612+ #[ inline]
45794613 fn on_platform_event_loop_wakeup (
45804614 & mut self ,
45814615 meta : & api:: EndpointMeta ,
@@ -7009,6 +7043,27 @@ pub mod builder {
70097043 }
70107044 }
70117045 #[ derive( Clone , Debug ) ]
7046+ #[ doc = " Emitted for each receive socket with per-socket packet counts" ]
7047+ pub struct PlatformRxSocketStats {
7048+ #[ doc = " Whether this socket is the prioritized socket" ]
7049+ pub is_prioritized : bool ,
7050+ #[ doc = " The number of packets received on this socket since the last event" ]
7051+ pub count : usize ,
7052+ }
7053+ impl IntoEvent < api:: PlatformRxSocketStats > for PlatformRxSocketStats {
7054+ #[ inline]
7055+ fn into_event ( self ) -> api:: PlatformRxSocketStats {
7056+ let PlatformRxSocketStats {
7057+ is_prioritized,
7058+ count,
7059+ } = self ;
7060+ api:: PlatformRxSocketStats {
7061+ is_prioritized : is_prioritized. into_event ( ) ,
7062+ count : count. into_event ( ) ,
7063+ }
7064+ }
7065+ }
7066+ #[ derive( Clone , Debug ) ]
70127067 pub struct PlatformEventLoopWakeup {
70137068 pub timeout_expired : bool ,
70147069 pub rx_ready : bool ,
@@ -7955,6 +8010,16 @@ mod traits {
79558010 let _ = meta;
79568011 let _ = event;
79578012 }
8013+ #[ doc = "Called when the `PlatformRxSocketStats` event is triggered" ]
8014+ #[ inline]
8015+ fn on_platform_rx_socket_stats (
8016+ & mut self ,
8017+ meta : & api:: EndpointMeta ,
8018+ event : & api:: PlatformRxSocketStats ,
8019+ ) {
8020+ let _ = meta;
8021+ let _ = event;
8022+ }
79588023 #[ doc = "Called when the `PlatformEventLoopWakeup` event is triggered" ]
79598024 #[ inline]
79608025 fn on_platform_event_loop_wakeup (
@@ -8676,6 +8741,15 @@ mod traits {
86768741 ( self . 1 ) . on_platform_feature_configured ( meta, event) ;
86778742 }
86788743 #[ inline]
8744+ fn on_platform_rx_socket_stats (
8745+ & mut self ,
8746+ meta : & api:: EndpointMeta ,
8747+ event : & api:: PlatformRxSocketStats ,
8748+ ) {
8749+ ( self . 0 ) . on_platform_rx_socket_stats ( meta, event) ;
8750+ ( self . 1 ) . on_platform_rx_socket_stats ( meta, event) ;
8751+ }
8752+ #[ inline]
86798753 fn on_platform_event_loop_wakeup (
86808754 & mut self ,
86818755 meta : & api:: EndpointMeta ,
@@ -8771,6 +8845,8 @@ mod traits {
87718845 fn on_platform_rx_error ( & mut self , event : builder:: PlatformRxError ) ;
87728846 #[ doc = "Publishes a `PlatformFeatureConfigured` event to the publisher's subscriber" ]
87738847 fn on_platform_feature_configured ( & mut self , event : builder:: PlatformFeatureConfigured ) ;
8848+ #[ doc = "Publishes a `PlatformRxSocketStats` event to the publisher's subscriber" ]
8849+ fn on_platform_rx_socket_stats ( & mut self , event : builder:: PlatformRxSocketStats ) ;
87748850 #[ doc = "Publishes a `PlatformEventLoopWakeup` event to the publisher's subscriber" ]
87758851 fn on_platform_event_loop_wakeup ( & mut self , event : builder:: PlatformEventLoopWakeup ) ;
87768852 #[ doc = "Publishes a `PlatformEventLoopSleep` event to the publisher's subscriber" ]
@@ -8900,6 +8976,13 @@ mod traits {
89008976 self . subscriber . on_event ( & self . meta , & event) ;
89018977 }
89028978 #[ inline]
8979+ fn on_platform_rx_socket_stats ( & mut self , event : builder:: PlatformRxSocketStats ) {
8980+ let event = event. into_event ( ) ;
8981+ self . subscriber
8982+ . on_platform_rx_socket_stats ( & self . meta , & event) ;
8983+ self . subscriber . on_event ( & self . meta , & event) ;
8984+ }
8985+ #[ inline]
89038986 fn on_platform_event_loop_wakeup ( & mut self , event : builder:: PlatformEventLoopWakeup ) {
89048987 let event = event. into_event ( ) ;
89058988 self . subscriber
@@ -9558,6 +9641,7 @@ pub mod testing {
95589641 pub platform_rx : u64 ,
95599642 pub platform_rx_error : u64 ,
95609643 pub platform_feature_configured : u64 ,
9644+ pub platform_rx_socket_stats : u64 ,
95619645 pub platform_event_loop_wakeup : u64 ,
95629646 pub platform_event_loop_sleep : u64 ,
95639647 pub platform_event_loop_started : u64 ,
@@ -9605,6 +9689,7 @@ pub mod testing {
96059689 platform_rx : 0 ,
96069690 platform_rx_error : 0 ,
96079691 platform_feature_configured : 0 ,
9692+ platform_rx_socket_stats : 0 ,
96089693 platform_event_loop_wakeup : 0 ,
96099694 platform_event_loop_sleep : 0 ,
96109695 platform_event_loop_started : 0 ,
@@ -9754,6 +9839,17 @@ pub mod testing {
97549839 let out = format ! ( "{meta:?} {event:?}" ) ;
97559840 self . output . push ( out) ;
97569841 }
9842+ fn on_platform_rx_socket_stats (
9843+ & mut self ,
9844+ meta : & api:: EndpointMeta ,
9845+ event : & api:: PlatformRxSocketStats ,
9846+ ) {
9847+ self . platform_rx_socket_stats += 1 ;
9848+ let meta = crate :: event:: snapshot:: Fmt :: to_snapshot ( meta) ;
9849+ let event = crate :: event:: snapshot:: Fmt :: to_snapshot ( event) ;
9850+ let out = format ! ( "{meta:?} {event:?}" ) ;
9851+ self . output . push ( out) ;
9852+ }
97579853 fn on_platform_event_loop_wakeup (
97589854 & mut self ,
97599855 meta : & api:: EndpointMeta ,
@@ -9855,6 +9951,7 @@ pub mod testing {
98559951 pub platform_rx : u64 ,
98569952 pub platform_rx_error : u64 ,
98579953 pub platform_feature_configured : u64 ,
9954+ pub platform_rx_socket_stats : u64 ,
98589955 pub platform_event_loop_wakeup : u64 ,
98599956 pub platform_event_loop_sleep : u64 ,
98609957 pub platform_event_loop_started : u64 ,
@@ -9951,6 +10048,7 @@ pub mod testing {
995110048 platform_rx : 0 ,
995210049 platform_rx_error : 0 ,
995310050 platform_feature_configured : 0 ,
10051+ platform_rx_socket_stats : 0 ,
995410052 platform_event_loop_wakeup : 0 ,
995510053 platform_event_loop_sleep : 0 ,
995610054 platform_event_loop_started : 0 ,
@@ -10779,6 +10877,17 @@ pub mod testing {
1077910877 let out = format ! ( "{meta:?} {event:?}" ) ;
1078010878 self . output . push ( out) ;
1078110879 }
10880+ fn on_platform_rx_socket_stats (
10881+ & mut self ,
10882+ meta : & api:: EndpointMeta ,
10883+ event : & api:: PlatformRxSocketStats ,
10884+ ) {
10885+ self . platform_rx_socket_stats += 1 ;
10886+ let meta = crate :: event:: snapshot:: Fmt :: to_snapshot ( meta) ;
10887+ let event = crate :: event:: snapshot:: Fmt :: to_snapshot ( event) ;
10888+ let out = format ! ( "{meta:?} {event:?}" ) ;
10889+ self . output . push ( out) ;
10890+ }
1078210891 fn on_platform_event_loop_wakeup (
1078310892 & mut self ,
1078410893 meta : & api:: EndpointMeta ,
@@ -10879,6 +10988,7 @@ pub mod testing {
1087910988 pub platform_rx : u64 ,
1088010989 pub platform_rx_error : u64 ,
1088110990 pub platform_feature_configured : u64 ,
10991+ pub platform_rx_socket_stats : u64 ,
1088210992 pub platform_event_loop_wakeup : u64 ,
1088310993 pub platform_event_loop_sleep : u64 ,
1088410994 pub platform_event_loop_started : u64 ,
@@ -10965,6 +11075,7 @@ pub mod testing {
1096511075 platform_rx : 0 ,
1096611076 platform_rx_error : 0 ,
1096711077 platform_feature_configured : 0 ,
11078+ platform_rx_socket_stats : 0 ,
1096811079 platform_event_loop_wakeup : 0 ,
1096911080 platform_event_loop_sleep : 0 ,
1097011081 platform_event_loop_started : 0 ,
@@ -11069,6 +11180,13 @@ pub mod testing {
1106911180 let out = format ! ( "{event:?}" ) ;
1107011181 self . output . push ( out) ;
1107111182 }
11183+ fn on_platform_rx_socket_stats ( & mut self , event : builder:: PlatformRxSocketStats ) {
11184+ self . platform_rx_socket_stats += 1 ;
11185+ let event = event. into_event ( ) ;
11186+ let event = crate :: event:: snapshot:: Fmt :: to_snapshot ( & event) ;
11187+ let out = format ! ( "{event:?}" ) ;
11188+ self . output . push ( out) ;
11189+ }
1107211190 fn on_platform_event_loop_wakeup ( & mut self , event : builder:: PlatformEventLoopWakeup ) {
1107311191 self . platform_event_loop_wakeup += 1 ;
1107411192 let event = event. into_event ( ) ;
0 commit comments