-
Notifications
You must be signed in to change notification settings - Fork 594
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
base: master
Are you sure you want to change the base?
Conversation
Target : [5386b0494d24a9cc15d643a7c5648452f877403b] - Code Rule Check (C++) OK. |
Target : [5386b0494d24a9cc15d643a7c5648452f877403b] - Code Rule Check OK. |
Target : [b0730e38f7dea20aadefddfb9b655642f650050e] - Code Rule Check OK. |
Target : [b0730e38f7dea20aadefddfb9b655642f650050e] - Code Rule Check (C++) OK. |
Target : [38e2e01bcc7331393089a46ea07fd649a15531fb] - Code Rule Check (C++) OK. |
Target : [38e2e01bcc7331393089a46ea07fd649a15531fb] - Code Rule Check OK. |
Target : [571604dee0216541c903b99f7bcc7a6cb3c0a8ee] - Code Rule Check (C++) OK. |
Target : [571604dee0216541c903b99f7bcc7a6cb3c0a8ee] - Code Rule Check OK. |
@hasw7569 Could you find some way to check pm enabled without external file, .config? |
There was a problem hiding this 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?
tools/ramdump/dumpParser.py
Outdated
|
||
STATE_STAY_POINT = g_pmglobals + DOMAIN_POINT + SIZE_OF_DOMAIN + 20 | ||
print('') | ||
print('Domain number is %d'%i) |
There was a problem hiding this comment.
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?
print('Domain number is %d'%i) | |
print('Domain number is', i) |
tools/ramdump/dumpParser.py
Outdated
print('************************') | ||
print(' State | Stay(sec) |') | ||
print('----------|------------|') | ||
for i in range(0, 4): |
There was a problem hiding this comment.
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.
for i in range(0, 4): | |
for i in range(4): |
tools/ramdump/dumpParser.py
Outdated
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)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How about this?
print('{:<10}|'.format(PM_STATUS[i]), '{:^11}|'.format(STAY_TIME)) | |
print(f'{PM_STATUS[i]:<10}| {STAY_TIME:^11}|') |
There was a problem hiding this comment.
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 ??
There was a problem hiding this comment.
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?
print('{:<10}|'.format(PM_STATUS[i]), '{:^11}|'.format(STAY_TIME)) | |
print('{:<10}| {:^11}|'.format(PM_STATUS[i], STAY_TIME)) |
There was a problem hiding this comment.
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.
Target : [898c54bb797a688674014e372553f838fa427949] - Code Rule Check (C++) OK. |
Target : [898c54bb797a688674014e372553f838fa427949] - Code Rule Check OK. |
tools/ramdump/dumpParser.py
Outdated
fd.close() | ||
|
||
if not 'CONFIG_PM_METRICS=y' in data: | ||
print('PM_METRICS is not enable. Enable PM_METRICS to see power management information') |
There was a problem hiding this comment.
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
?
Target : [8f28d75e94f76d6635348b5af26d9f7bc21de3e4] - Code Rule Check OK. |
Target : [8f28d75e94f76d6635348b5af26d9f7bc21de3e4] - Code Rule Check (C++) OK. |
os/board/common/crashdump.c
Outdated
@@ -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) |
There was a problem hiding this comment.
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
....
...
tools/ramdump/ramdump_tool.c
Outdated
config_info_size = sizeof(uint32_t); | ||
while (config_info_cnt) { | ||
while (config_info_size) { | ||
ret = read(dev_fd, &buf, 1); |
There was a problem hiding this comment.
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
tools/ramdump/ramdump_tool.c
Outdated
fclose(bin_fp); | ||
return -1; | ||
} | ||
ret = fwrite(&buf, 1, 1, bin_fp); |
There was a problem hiding this comment.
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...
os/board/common/crashdump.c
Outdated
@@ -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 |
There was a problem hiding this comment.
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.
Target : [7a5d633] - Code Rule Check (C++) OK. |
Target : [7a5d633] - Code Rule Check OK. |
1 similar comment
Target : [7a5d633] - Code Rule Check OK. |
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
Activities of registered drivers and Wakeup reason of Sleep state
Current state is PM_SLEEP