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

Power management stat : add verbosity level for MBED_SLEEP_TRACING_ENABLED #14610

Merged
merged 2 commits into from
Nov 8, 2021

Conversation

jeromecoutant
Copy link
Collaborator

@jeromecoutant jeromecoutant commented Apr 30, 2021

Summary of changes

Using MBED_SLEEP_TRACING_ENABLED is not reliable with STM32 targets.

See discussions in #11497 #14580 ...

[edit]
This new MBED_SLEEP_STAT_ENABLED macro is the same one
removing prints at each sleep_manager_lock/unlock_deep_sleep

  • deepsleep stats can be enabled now with json config
  • default configuration is not changed (full verbosity adding a console line for each lock/unlock command)
  • except for STM32 targets, verbosity is reduced by default

Impact of changes

Migration actions required

Documentation

STM32 readme file is updated


Pull request type

[x] Patch update (Bug fix / Target update / Docs update / Test update / Refactor)
[] Feature update (New feature / Functionality change / New API)
[] Major update (Breaking change E.g. Return code change / API behaviour change)

Test results

[] No Tests required for this change (E.g docs only update)
[x] Covered by existing mbed-os tests (Greentea or Unittest)
[] Tests / results supplied as part of this PR

Reviewers

@ARMmbed/team-st-mcd


@ciarmcom ciarmcom added the release-type: patch Indentifies a PR as containing just a patch label Apr 30, 2021
@ciarmcom
Copy link
Member

@jeromecoutant, thank you for your changes.
@ARMmbed/mbed-os-maintainers please review.

@@ -90,7 +90,7 @@ extern "C" {
*
*/

#ifdef MBED_SLEEP_TRACING_ENABLED
#if defined(MBED_SLEEP_TRACING_ENABLED) || defined(MBED_SLEEP_STAT_ENABLED)
Copy link
Contributor

Choose a reason for hiding this comment

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

I need to read the discussion but still this one commit does not explain one why there would be a need for additional macro (there is || between so one of them needs t obe truth at least,why ? ).

Copy link
Collaborator Author

@jeromecoutant jeromecoutant Apr 30, 2021

Choose a reason for hiding this comment

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

Because ST LPTICKER API calls the deepsleep lock function very very often:
https://github.com/ARMmbed/mbed-os/blob/master/targets/TARGET_STM/lp_ticker.c#L471

So I let the current macro as it is and as it is described in mbed-os doc,
and created a new one, a bit less verbose.

- deepsleep can also be disabled by application or drivers using sleep_manager_lock_deep_sleep()

To enable the tracing, it is recommended to **not** define MBED_SLEEP_TRACING_ENABLED macro,
but **MBED_SLEEP_STAT_ENABLED** macro.
Copy link
Contributor

Choose a reason for hiding this comment

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

To my question above, why is not recommended/ Shoudn't the one be fixed rather than create two (it might confuse people) ?

Copy link
Contributor

Choose a reason for hiding this comment

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

Add here some details why stats only.

@ciarmcom
Copy link
Member

@jeromecoutant, thank you for your changes.
@ARMmbed/mbed-os-maintainers please review.

@ciarmcom ciarmcom requested a review from a team April 30, 2021 15:00
@0xc0170
Copy link
Contributor

0xc0170 commented May 3, 2021

Because ST LPTICKER API calls the deepsleep lock function very very often:

#11497 (comment) - if this is required to be so, locking so often, then printing is correct. The problem is how to filter these as there are too many locks?

#14580 - how is this related to the issue?

We will need to review this in detail. I don't believe adding a new macro is an answer. I find it confusing which one I should define and why.

@jeromecoutant
Copy link
Collaborator Author

#14580 - how is this related to the issue?

Not directly related to this issue. This issue confirms that we need something to be able to trace sleep lock with STM32 use case.

We will need to review this in detail. I don't believe adding a new macro is an answer. I find it confusing which one I should define and why.

The default macro is not usable for STM32.

@ciarmcom ciarmcom added the stale Stale Pull Request label May 10, 2021
@ciarmcom
Copy link
Member

This pull request has automatically been marked as stale because it has had no recent activity. @ARMmbed/mbed-os-maintainers, please complete review of the changes to move the PR forward. Thank you for your contributions.

@ciarmcom ciarmcom added stale Stale Pull Request and removed stale Stale Pull Request labels May 14, 2021
@0xc0170 0xc0170 requested a review from a team May 18, 2021 09:18
@0xc0170 0xc0170 removed the stale Stale Pull Request label May 18, 2021
Copy link
Contributor

@0xc0170 0xc0170 left a comment

Choose a reason for hiding this comment

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

MBED_SLEEP_STATS_ENABLED could it be named similarly as the functions in the power mgmt

Not against introducing the stats only. My understanding is tracing in this case for stm32 is way to verbose (happens very frequently) and thus can't be used. Stats however are useful information and can be printed. What a user should do if they need tracing (are there any options for them) ?

Please review @ARMmbed/mbed-os-core review

@@ -239,6 +243,9 @@ void sleep_manager_sleep_auto(void)
#endif
hal_deepsleep();
} else {
#if defined(MBED_SLEEP_STAT_ENABLED)
Copy link
Contributor

Choose a reason for hiding this comment

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

you get stats at the top of this function, do we need to print this again when only sleeping?

- deepsleep can also be disabled by application or drivers using sleep_manager_lock_deep_sleep()

To enable the tracing, it is recommended to **not** define MBED_SLEEP_TRACING_ENABLED macro,
but **MBED_SLEEP_STAT_ENABLED** macro.
Copy link
Contributor

Choose a reason for hiding this comment

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

Add here some details why stats only.

@ciarmcom ciarmcom added the stale Stale Pull Request label May 21, 2021
@ciarmcom
Copy link
Member

This pull request has automatically been marked as stale because it has had no recent activity. , please complete review of the changes to move the PR forward. Thank you for your contributions.

@ciarmcom ciarmcom added stale Stale Pull Request and removed stale Stale Pull Request labels May 21, 2021
@ciarmcom ciarmcom removed the stale Stale Pull Request label May 24, 2021
@ciarmcom ciarmcom added the stale Stale Pull Request label Jun 3, 2021
@ciarmcom
Copy link
Member

ciarmcom commented Jun 3, 2021

This pull request has automatically been marked as stale because it has had no recent activity. @jeromecoutant, please carry out any necessary work to get the changes merged. Thank you for your contributions.

@ciarmcom ciarmcom added stale Stale Pull Request and removed stale Stale Pull Request labels Jun 4, 2021
@jeromecoutant
Copy link
Collaborator Author

ping :-)

0xc0170
0xc0170 previously requested changes Nov 3, 2021
Copy link
Contributor

@0xc0170 0xc0170 left a comment

Choose a reason for hiding this comment

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

The printf there with allo does not provide sufficient meaning to a reader. What should be printed?

}

if (sleep_stats[i].identifier[0] == '\0') {
mbed_error_printf("allo");
Copy link
Contributor

Choose a reason for hiding this comment

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

Why is it allo ? Should this be something more meaningful ?

Copy link
Contributor

Choose a reason for hiding this comment

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

I reviewed this but kept the review pending (not certain why it was not posted).

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

oups...

…ABLED

Full verbosity is adding a console line for each lock/unlock API call

- stats can be enabled with json config
- default configuration is full verbosity and add a console line for each lock/unlock command
- for STM32 targets, verbosity is reduced by default
Mbed Core automation moved this from Review in progress (4) to Reviewer approved & awaiting CI & merge (3) Nov 8, 2021
@mergify mergify bot added needs: CI and removed needs: review labels Nov 8, 2021
@mbed-ci
Copy link

mbed-ci commented Nov 8, 2021

Jenkins CI Test : ✔️ SUCCESS

Build Number: 1 | 🔒 Jenkins CI Job | 🌐 Logs & Artifacts

CLICK for Detailed Summary

jobs Status
jenkins-ci/mbed-os-ci_build-cloud-example-ARM ✔️
jenkins-ci/mbed-os-ci_unittests ✔️
jenkins-ci/mbed-os-ci_build-cloud-example-GCC_ARM ✔️
jenkins-ci/mbed-os-ci_build-greentea-ARM ✔️
jenkins-ci/mbed-os-ci_build-greentea-GCC_ARM ✔️
jenkins-ci/mbed-os-ci_build-example-ARM ✔️
jenkins-ci/mbed-os-ci_build-example-GCC_ARM ✔️
jenkins-ci/mbed-os-ci_greentea-test ✔️

@0xc0170
Copy link
Contributor

0xc0170 commented Nov 8, 2021

@LDong-Arm Can you please review?

Copy link
Contributor

@LDong-Arm LDong-Arm left a comment

Choose a reason for hiding this comment

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

LGTM as per previous discussion regarding the documentation of the new config.

@0xc0170 0xc0170 merged commit d4c6b37 into ARMmbed:master Nov 8, 2021
Mbed Core automation moved this from Reviewer approved & awaiting CI & merge (3) to Done Nov 8, 2021
@mergify mergify bot removed the ready for merge label Nov 8, 2021
@jeromecoutant jeromecoutant deleted the DEV_SLEEP_TRACE branch November 8, 2021 16:09
@mbedmain mbedmain added release-version: 6.15.1 Release-pending and removed release-type: patch Indentifies a PR as containing just a patch Release-pending labels Nov 22, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
No open projects
Mbed Core
  
Done
Development

Successfully merging this pull request may close these issues.

None yet

7 participants