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

tools/ramdump : Add PM dumpparser #4224

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

hasw7569
Copy link
Contributor

@hasw7569 hasw7569 commented Mar 6, 2020

This commit adds PM dumpparser.
It displays wakeup reason and stay time of each pm state and activities of registered driver in each pm state.
also It displays accumulated stay time for each pm state.

ex)
Domain number is 0


Stay time for each PM state



State Stay(sec)
PM_NORMAL 3
PM_IDLE 5
PM_STANDBY 7
PM_SLEEP 0

Activities of registered drivers and Wakeup reason of Sleep state



State Stay(sec) Wakeup Reason Drv_name , activity Drv_name , activity Drv_name , activity
PM_NORMAL 3 None UART , 0 TEST1 , 0 TEST2 , 0
PM_IDLE 5 None UART , 0 TEST1 , 0 TEST2 , 0
PM_STANDBY 7 None UART , 0 TEST1 , 0 TEST2 , 0

Current state is PM_SLEEP

@seinfra
Copy link

seinfra commented Mar 6, 2020

Target : [5386b0494d24a9cc15d643a7c5648452f877403b] - Code Rule Check (C++) OK.

@seinfra
Copy link

seinfra commented Mar 6, 2020

Target : [5386b0494d24a9cc15d643a7c5648452f877403b] - Code Rule Check OK.

@seinfra
Copy link

seinfra commented Mar 6, 2020

Target : [b0730e38f7dea20aadefddfb9b655642f650050e] - Code Rule Check OK.

@seinfra
Copy link

seinfra commented Mar 6, 2020

Target : [b0730e38f7dea20aadefddfb9b655642f650050e] - Code Rule Check (C++) OK.

@seinfra
Copy link

seinfra commented Mar 9, 2020

Target : [38e2e01bcc7331393089a46ea07fd649a15531fb] - Code Rule Check (C++) OK.

@seinfra
Copy link

seinfra commented Mar 9, 2020

Target : [38e2e01bcc7331393089a46ea07fd649a15531fb] - Code Rule Check OK.

@seinfra
Copy link

seinfra commented Mar 9, 2020

Target : [571604dee0216541c903b99f7bcc7a6cb3c0a8ee] - Code Rule Check (C++) OK.

@seinfra
Copy link

seinfra commented Mar 9, 2020

Target : [571604dee0216541c903b99f7bcc7a6cb3c0a8ee] - Code Rule Check OK.

@sunghan-chang
Copy link
Contributor

@hasw7569 Could you find some way to check pm enabled without external file, .config?

Copy link
Contributor

@junmin-kim junmin-kim left a comment

Choose a reason for hiding this comment

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

I added some trivial comment.
Would you check these comment?


STATE_STAY_POINT = g_pmglobals + DOMAIN_POINT + SIZE_OF_DOMAIN + 20
print('')
print('Domain number is %d'%i)
Copy link
Contributor

Choose a reason for hiding this comment

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

Is there a reason for using old formatting?

Suggested change
print('Domain number is %d'%i)
print('Domain number is', i)

print('************************')
print(' State | Stay(sec) |')
print('----------|------------|')
for i in range(0, 4):
Copy link
Contributor

Choose a reason for hiding this comment

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

The start praramter is optional.

Suggested change
for i in range(0, 4):
for i in range(4):

print('----------|------------|')
for i in range(0, 4):
STAY_TIME = rParser.read_halfword(STATE_STAY_POINT + (i * 2))
print('{:<10}|'.format(PM_STATUS[i]), '{:^11}|'.format(STAY_TIME))
Copy link
Contributor

Choose a reason for hiding this comment

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

How about this?

Suggested change
print('{:<10}|'.format(PM_STATUS[i]), '{:^11}|'.format(STAY_TIME))
print(f'{PM_STATUS[i]:<10}| {STAY_TIME:^11}|')

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thank you for your comments : )
But it makes build error in my enviroment.
Is this right syntax ??

Copy link
Contributor

@junmin-kim junmin-kim Mar 11, 2020

Choose a reason for hiding this comment

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

Which version of python do you use?
If below code work on your environment, how about this?

Suggested change
print('{:<10}|'.format(PM_STATUS[i]), '{:^11}|'.format(STAY_TIME))
print('{:<10}| {:^11}|'.format(PM_STATUS[i], STAY_TIME))

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It works well : )
Thank you.

@seinfra
Copy link

seinfra commented Mar 11, 2020

Target : [898c54bb797a688674014e372553f838fa427949] - Code Rule Check (C++) OK.

@seinfra
Copy link

seinfra commented Mar 11, 2020

Target : [898c54bb797a688674014e372553f838fa427949] - Code Rule Check OK.

@hasw7569 hasw7569 changed the title TizenRT/tools/ramdump/dumpParser.py : Add PM dumpparser tools/ramdump : Add PM dumpparser Mar 11, 2020
fd.close()

if not 'CONFIG_PM_METRICS=y' in data:
print('PM_METRICS is not enable. Enable PM_METRICS to see power management information')
Copy link
Contributor

Choose a reason for hiding this comment

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

How about raise syntax instead of print and return?

@seinfra
Copy link

seinfra commented Mar 12, 2020

Target : [8f28d75e94f76d6635348b5af26d9f7bc21de3e4] - Code Rule Check OK.

@seinfra
Copy link

seinfra commented Mar 12, 2020

Target : [8f28d75e94f76d6635348b5af26d9f7bc21de3e4] - Code Rule Check (C++) OK.

@@ -40,6 +40,7 @@
#if defined(CONFIG_BOARD_RAMDUMP_UART)
#define HANDSHAKE_STRING "RAMDUMP"
#define HANDSHAKE_STR_LEN_MAX (7)
#define SETBIT(target, value, shift) target |= (value << shift)
Copy link
Contributor

Choose a reason for hiding this comment

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

Instead of macro, you'd better define values first.
It is good habit to classify with just one variable or flag.

#ifdef CONFIG_PM_METRICS //these config is not really necessary, actually because all values are diffrent.
#define RAMDUMP_CONFIG_PM 0x00 // but 0x00 is not good choice. start it from 0x01
#endif
#ifdef CONFIG_BINMGR_RECOVERY
#define RAMDUMP_CONFIG_BM 0x02
#endif
....

And then,

#ifdef CONFIG_PM_METRICS
       pm_config_info |= RAMDUMP_CONFIG_PM;
#endif
....
...

config_info_size = sizeof(uint32_t);
while (config_info_cnt) {
while (config_info_size) {
ret = read(dev_fd, &buf, 1);
Copy link
Contributor

Choose a reason for hiding this comment

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

Is there any specific reason why it ready and write byte by byte?
Why don't you read & write just once with bytes of config_info_size?
I/O always takes most long time than any other operation, as possible as we can, we should reduce I/O

fclose(bin_fp);
return -1;
}
ret = fwrite(&buf, 1, 1, bin_fp);
Copy link
Contributor

Choose a reason for hiding this comment

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

As per my experience, streaming is always slower than POSIX, you have any reason why use fwrite instead of write?
you are already using 'read' in line 334 with another file descriptor...

@@ -71,6 +72,37 @@ static int ramdump_via_uart(void)
char host_reg[1] = "";
char *target_str = HANDSHAKE_STRING;
char host_buf[HANDSHAKE_STR_LEN_MAX] = "";
uint8_t config_info_cnt = 0;
#ifdef CONFIG_PM_METRICS
Copy link
Contributor

Choose a reason for hiding this comment

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

Please add description about each bit.

This commit adds PM dumpparser.
It displays wakeup reason and stay time of each pm state and activities of registered driver in each pm state.
also It displays accumulated stay time for each pm state.

ex)
Domain number is 0
***************************
Stay time for each PM state
***************************

************************
   State  |  Stay(sec) |
----------|------------|
PM_NORMAL |      3     |
PM_IDLE   |      5     |
PM_STANDBY|      7     |
PM_SLEEP  |      0     |

*****************************************************************
Activities of registered drivers and Wakeup reason of Sleep state
*****************************************************************

*******************************************************************************************************************
   State  |  Stay(sec) |    Wakeup Reason    |  Drv_name  , activity|  Drv_name  , activity|  Drv_name  , activity|
----------|------------|---------------------|----------------------|----------------------|----------------------|
PM_NORMAL |      3     |         None        |    UART    ,    0    |   TEST1    ,    0    |   TEST2    ,    0    |
PM_IDLE   |      5     |         None        |    UART    ,    0    |   TEST1    ,    0    |   TEST2    ,    0    |
PM_STANDBY|      7     |         None        |    UART    ,    0    |   TEST1    ,    0    |   TEST2    ,    0    |

Current state is PM_SLEEP
This commit updates common crashdump code to insert configuration informations into dumpfile.
@seinfra
Copy link

seinfra commented Mar 17, 2020

Target : [7a5d633] - Code Rule Check (C++) OK.

@seinfra
Copy link

seinfra commented Mar 17, 2020

Target : [7a5d633] - Code Rule Check OK.

1 similar comment
@tizen-build
Copy link

Target : [7a5d633] - Code Rule Check OK.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants