Skip to content

Add CPU stats for greentea tests #7294

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

Merged
merged 1 commit into from
Jun 30, 2018

Conversation

jeromecoutant
Copy link
Collaborator

Description

Here is a proposition to add CPU info at the end of each greentea tests.

[1529585766.11][CONN][RXD] {{__cpu_info up time;1779541}}
[1529585766.15][CONN][RXD] {{__cpu_info sleep time;4516}}
[1529585766.19][CONN][RXD] {{__cpu_info deepsleep time;931397}}
[1529585766.22][CONN][RXD] {{__cpu_info % sleep / deep;0;49}}

Pull request type

[ ] Fix
[ ] Refactor
[ ] New target
[x] Feature
[ ] Breaking change

@screamerbg
Copy link
Contributor

I like this! Do we have some way to measure tick counts and use the data as performance measurement? @0xc0170

@0xc0170 0xc0170 requested review from a team, OPpuolitaival and studavekar June 21, 2018 13:09
cmonr
cmonr previously approved these changes Jun 21, 2018
Copy link
Contributor

@cmonr cmonr left a comment

Choose a reason for hiding this comment

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

I -really- like this.

@cmonr
Copy link
Contributor

cmonr commented Jun 21, 2018

@studavekar Thoughts?

@cmonr
Copy link
Contributor

cmonr commented Jun 21, 2018

@screamerbg I think the people that could best answer that are @SenRamakri and/or @deepikabhavnani

@deepikabhavnani
Copy link

deepikabhavnani commented Jun 21, 2018

I like this! Do we have some way to measure tick counts and use the data as performance measurement?

Performance in terms of what?
We have way to calculate the CPU load (https://github.com/ARMmbed/mbed-os-example-cpu-usage/blob/master/main.cpp) which can be compared across different targets and application.

With the help of deep sleep / sleep comparison you can compare to see if deep sleep will help in battery saving (need to do some target specific analysis for that) - May be in future

greentea_send_kv("__cpu_info up time", mbed_uptime());
greentea_send_kv("__cpu_info sleep time", mbed_time_sleep());
greentea_send_kv("__cpu_info deepsleep time", mbed_time_deepsleep());
greentea_send_kv("__cpu_info % sleep / deep", (mbed_time_sleep() * 100) / mbed_uptime(), (mbed_time_deepsleep() * 100) / mbed_uptime());

Choose a reason for hiding this comment

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

(mbed_time_deepsleep() * 100) / mbed_uptime())

Not sure how useful this stat is, it says how much % time system spent in sleep since it was up. But will be interesting to see its result for different test application.

@studavekar
Copy link
Contributor

This would be a good addition to provide additional cpu information, It would useful for teams to check device sleep status during the test execution. 👍

studavekar
studavekar previously approved these changes Jun 21, 2018
@cmonr
Copy link
Contributor

cmonr commented Jun 21, 2018

/morph build

@mbed-ci
Copy link

mbed-ci commented Jun 21, 2018

Build : FAILURE

Build number : 2424
Build artifacts/logs : http://mbed-os.s3-website-eu-west-1.amazonaws.com/?prefix=builds/7294/

@cmonr
Copy link
Contributor

cmonr commented Jun 21, 2018

Darn. Looks like it's not going to be that simple and easy.

@jeromecoutant, please take a look at the build failures.

#if defined(MBED_CPU_STATS_ENABLED)
static void send_CPU_info()
{
greentea_send_kv("__cpu_info up time", mbed_uptime());

Choose a reason for hiding this comment

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

mbed_uptime , mbed_time_sleep , mbed_time_deepsleep are not API's. They are internal functions in Mbed OS.
Please use mbed_stats_cpu_get to get all CPU related info

Copy link
Contributor

@0xc0170 0xc0170 Jun 27, 2018

Choose a reason for hiding this comment

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

@deepikabhavnani We might want to add that detail to the documentation? These functions are declared in power management header file - thus I would also use it . I do not see any internal detail mentioned there.

If they are internal, why are there declared then in the power m. header file (we got there _internal functions - intention is clear).

Choose a reason for hiding this comment

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

@0xc0170 - I was not completely clear with my comment, those functions can be used if required. But since this PR is about adding CPU stats for testing it will be good to use actual API mbed_stats_cpu_get and not the functions called by API.

Copy link
Contributor

Choose a reason for hiding this comment

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

Understood . Still confusing to a user - which one to use? Is it fine as it is, all those functions exposed ?

@jeromecoutant Can you update to use mbed_stats_cpu_get rather?

Choose a reason for hiding this comment

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

User can use mbed_uptime just to know since when the system is up and running (ok to have public). mbed_stats_cpu_get will give all the cpu related information. We have plans to expand this API to have additional information and parts of which may not be in power management header file.

OPpuolitaival
OPpuolitaival previously approved these changes Jun 26, 2018
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.

We need to be clear about mbed_uptime vs mbed_stats.

@deepikabhavnani Please address the comment about those functions. Once done, this should be good to go

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.

@jeromecoutant Can you update to use mbed_stats_cpu_get rather?

@jeromecoutant
Copy link
Collaborator Author

@0xc0170 Update is done

@0xc0170
Copy link
Contributor

0xc0170 commented Jun 28, 2018

Considering that previous set was approved (similar to the current one, just one change there), starting CI

/morph build

@mbed-ci
Copy link

mbed-ci commented Jun 28, 2018

Build : SUCCESS

Build number : 2471
Build artifacts/logs : http://mbed-os.s3-website-eu-west-1.amazonaws.com/?prefix=builds/7294/

Triggering tests

/morph test
/morph uvisor-test
/morph export-build
/morph mbed2-build

@mbed-ci
Copy link

mbed-ci commented Jun 28, 2018

@cmonr
Copy link
Contributor

cmonr commented Jun 28, 2018

/morph export-build

@mbed-ci
Copy link

mbed-ci commented Jun 28, 2018

@mbed-ci
Copy link

mbed-ci commented Jun 28, 2018

@cmonr
Copy link
Contributor

cmonr commented Jun 29, 2018

/morph export-build

@mbed-ci
Copy link

mbed-ci commented Jun 29, 2018

@cmonr cmonr merged commit f10bb88 into ARMmbed:master Jun 30, 2018
@jeromecoutant jeromecoutant deleted the PR_GREENTEA_STAT branch July 2, 2018 07:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants