diff mbox series

acpi/s3: fine-tune measure of suspend time

Message ID 20191030174401.10926-1-alex.hung@canonical.com
State Accepted
Headers show
Series acpi/s3: fine-tune measure of suspend time | expand

Commit Message

Alex Hung Oct. 30, 2019, 5:44 p.m. UTC
The time variation can be reduced. For example, the original suspend
time:
  Suspend: 3.966 seconds.
  Suspend: 0.539 seconds.
  Suspend: 1.156 seconds.
After patched:
  Suspend: 0.486 seconds.
  Suspend: 0.508 seconds.
  Suspend: 0.528 seconds.

This is especially true for 1st suspend when kernel is busy with other
kernel modules such as

[  120.123903] fwts: Suspend
[  120.162215] wlp60s0: deauthenticating from ...
[  123.726367] PM: suspend entry (deep)

Signed-off-by: Alex Hung <alex.hung@canonical.com>
---
 src/acpi/s3/s3.c | 7 +++++++
 1 file changed, 7 insertions(+)

Comments

Colin Ian King Oct. 30, 2019, 8:01 p.m. UTC | #1
On 30/10/2019 18:44, Alex Hung wrote:
> The time variation can be reduced. For example, the original suspend
> time:
>   Suspend: 3.966 seconds.
>   Suspend: 0.539 seconds.
>   Suspend: 1.156 seconds.
> After patched:
>   Suspend: 0.486 seconds.
>   Suspend: 0.508 seconds.
>   Suspend: 0.528 seconds.
> 
> This is especially true for 1st suspend when kernel is busy with other
> kernel modules such as
> 
> [  120.123903] fwts: Suspend
> [  120.162215] wlp60s0: deauthenticating from ...
> [  123.726367] PM: suspend entry (deep)
> 
> Signed-off-by: Alex Hung <alex.hung@canonical.com>

Thanks Alex.

Acked-by: Colin Ian King <colin.king@canonical.com>

> ---
>  src/acpi/s3/s3.c | 7 +++++++
>  1 file changed, 7 insertions(+)
> 
> diff --git a/src/acpi/s3/s3.c b/src/acpi/s3/s3.c
> index 6664db2c..5ec8d5c8 100644
> --- a/src/acpi/s3/s3.c
> +++ b/src/acpi/s3/s3.c
> @@ -411,6 +411,13 @@ static int s3_scan_times(
>  			s3_suspend_start = ts;
>  			continue;
>  		}
> +
> +		/* Update log time if this is available */
> +		if (strstr(txt, "PM: suspend entry")) {
> +			s3_suspend_start = ts;
> +			continue;
> +		}
> +
>  		if (strstr(txt, FWTS_RESUME)) {
>  			s3_resume_finish = ts;
>  			continue;
>
Anthony Wong Oct. 31, 2019, 1:42 a.m. UTC | #2
On Thu, Oct 31, 2019 at 1:44 AM Alex Hung <alex.hung@canonical.com> wrote:
>
> The time variation can be reduced. For example, the original suspend
> time:
>   Suspend: 3.966 seconds.
>   Suspend: 0.539 seconds.
>   Suspend: 1.156 seconds.
> After patched:
>   Suspend: 0.486 seconds.
>   Suspend: 0.508 seconds.
>   Suspend: 0.528 seconds.
>
> This is especially true for 1st suspend when kernel is busy with other
> kernel modules such as
>
> [  120.123903] fwts: Suspend
> [  120.162215] wlp60s0: deauthenticating from ...
> [  123.726367] PM: suspend entry (deep)
>
> Signed-off-by: Alex Hung <alex.hung@canonical.com>
> ---
>  src/acpi/s3/s3.c | 7 +++++++
>  1 file changed, 7 insertions(+)
>
> diff --git a/src/acpi/s3/s3.c b/src/acpi/s3/s3.c
> index 6664db2c..5ec8d5c8 100644
> --- a/src/acpi/s3/s3.c
> +++ b/src/acpi/s3/s3.c
> @@ -411,6 +411,13 @@ static int s3_scan_times(
>                         s3_suspend_start = ts;
>                         continue;
>                 }
> +
> +               /* Update log time if this is available */
> +               if (strstr(txt, "PM: suspend entry")) {
> +                       s3_suspend_start = ts;
> +                       continue;
> +               }
> +
>                 if (strstr(txt, FWTS_RESUME)) {
>                         s3_resume_finish = ts;
>                         continue;
> --
> 2.17.1

Thanks Alex for looking at this issue.
Seems if we can also record the time between fwts starts suspending
and pm_suspend() is called, that's still valuable for discovering
issues that takes a long time before the system can go to suspend.

Acked-by: Anthony Wong <anthony.wong@canonical.com>
diff mbox series

Patch

diff --git a/src/acpi/s3/s3.c b/src/acpi/s3/s3.c
index 6664db2c..5ec8d5c8 100644
--- a/src/acpi/s3/s3.c
+++ b/src/acpi/s3/s3.c
@@ -411,6 +411,13 @@  static int s3_scan_times(
 			s3_suspend_start = ts;
 			continue;
 		}
+
+		/* Update log time if this is available */
+		if (strstr(txt, "PM: suspend entry")) {
+			s3_suspend_start = ts;
+			continue;
+		}
+
 		if (strstr(txt, FWTS_RESUME)) {
 			s3_resume_finish = ts;
 			continue;