Samsung / TizenRT

TizenRT is a lightweight RTOS-based platform to support low-end IoT devices
Apache License 2.0
561 stars 560 forks source link

os/pm: Add PM Metrics #6241

Closed gSahitya-samsung closed 6 days ago

gSahitya-samsung commented 2 weeks ago

This commit enables PM Monitoring system which captures the PM Sleep and Suspend activity for specified time interval in milliseconds. It shows the suspend time, suspend time percent, and stay counts of each domain with pm state sleep time information.

gSahitya-samsung commented 2 weeks ago
TASH>>pm_metrics 60000
pm_print_metrics: 
pm_print_metrics: TOTAL METRICS TIME [1] = 60011ms
pm_print_metrics: TOTAL SLEEP TRY TIME [2] = 25938ms
pm_print_metrics: *[2] = represents total duration of time, PM tries to make board sleep.
pm_print_metrics: 
pm_print_metrics: 
pm_print_metrics:               DOMAIN              | TOTAL PM SUSPEND TIME [3] | TOTAL SLEEP BLOCKING TIME [4] 
pm_print_metrics: ----------------------------------|---------------------------|-------------------------------
pm_print_metrics:                              IDLE |         14775ms ( 24.62%) |             14775ms ( 56.96%) 
pm_print_metrics:                            SCREEN |             0ms (  0.00%) |                 0ms (  0.00%) 
pm_print_metrics:                              UART |             0ms (  0.00%) |                 0ms (  0.00%) 
pm_print_metrics:                               SPI |             0ms (  0.00%) |                 0ms (  0.00%) 
pm_print_metrics:                              TASH |         13777ms ( 22.96%) |             13778ms ( 53.12%) 
pm_print_metrics: 
pm_print_metrics: *[3] = total time pm domain was suspended.
pm_print_metrics: *[4] = represents the time board was not able to sleep due to suspended domain.
pm_print_metrics: *[3] (%) = [3] / [1] * 100
pm_print_metrics: *[4] (%) = [4] / [2] * 100
pm_print_metrics: 
pm_print_metrics: 
pm_print_metrics:  WAKEUP SOURCES | COUNTS 
pm_print_metrics: ----------------|--------
pm_print_metrics:         UNKNOWN |      0 
pm_print_metrics:             BLE |      0 
pm_print_metrics:            WIFI |      0 
pm_print_metrics:    UART CONSOLE |     14 
pm_print_metrics:      UART TTYS2 |      0 
pm_print_metrics:            GPIO |      0 
pm_print_metrics:        HW TIMER |      1 
pm_print_metrics: 
pm_print_metrics: 
pm_print_metrics:  BOARD STATE | PM STATE |          TIME          
pm_print_metrics: -------------|----------|------------------------
pm_print_metrics:       WAKEUP |   NORMAL |      14776ms ( 24.62%) 
pm_print_metrics:              |     IDLE |          0ms (  0.00%) 
pm_print_metrics:              |  STANDBY |      11164ms ( 18.60%) 
pm_print_metrics: -------------|----------|------------------------
pm_print_metrics:        SLEEP |    SLEEP |      34071ms ( 56.77%) 
gSahitya-samsung commented 2 weeks ago

This PR has dependency with PRs https://github.com/Samsung/TizenRT/pull/6230, https://github.com/Samsung/TizenRT/pull/6246 to add wakeup source metrics

ewoodev commented 1 week ago

We can also reduce power consumption as much as WFE is called.

Would it be helpful to measure the count of times WFE is called?

Number of WFE calls for each CPU compared to the total tick increase