[riot-notifications] [RIOT-OS/RIOT] gnrc_lwmac: enable radio duty-cycle printing. (#8942)

zhuoshuguo notifications at github.com
Tue Jan 22 10:48:49 CET 2019


zhuoshuguo commented on this pull request.



> @@ -880,7 +872,16 @@ static void _lwmac_msg_handler(gnrc_netif_t *netif, msg_t *msg)
             lwmac_schedule_update(netif);
             break;
         }
-
+#if (GNRC_MAC_ENABLE_DUTYCYCLE_RECORD == 1)
+        case GNRC_MAC_TYPE_GET_DUTYCYCLE: {
+            /* Output LWMAC's radio duty-cycle ratio */
+            uint64_t duty = (uint64_t) rtt_get_counter();
+            duty = ((uint64_t) netif->mac.prot.lwmac.awake_duration_sum_ticks) * 100 /
+                   (duty - (uint64_t)netif->mac.prot.lwmac.system_start_time_ticks);
+            printf("[LWMAC]: achieved radio duty-cycle: %u %% \n", (uint16_t) duty);

Just to fit the printf in `%u`.

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/RIOT-OS/RIOT/pull/8942#discussion_r249706719
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.riot-os.org/pipermail/notifications/attachments/20190122/777b7cef/attachment-0001.html>


More information about the notifications mailing list