diff mbox series

acpi/s3: fix no suspend & resume time for s2idle

Message ID 20191030175517.12733-1-alex.hung@canonical.com
State Accepted
Headers show
Series acpi/s3: fix no suspend & resume time for s2idle | expand

Commit Message

Alex Hung Oct. 30, 2019, 5:55 p.m. UTC
This is to fix

Suspend/Resume Timings:
  Could not determine time to suspend.
  Could not determine time to resume.

to

Suspend/Resume Timings:
  Suspend: 0.282 seconds.
  Resume:  1.008 seconds.

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

Comments

Colin Ian King Nov. 6, 2019, 10:47 a.m. UTC | #1
On 30/10/2019 17:55, Alex Hung wrote:
> This is to fix
> 
> Suspend/Resume Timings:
>   Could not determine time to suspend.
>   Could not determine time to resume.
> 
> to
> 
> Suspend/Resume Timings:
>   Suspend: 0.282 seconds.
>   Resume:  1.008 seconds.
> 
> Signed-off-by: Alex Hung <alex.hung@canonical.com>
> ---
>  src/acpi/s3/s3.c | 13 +++++++++++++
>  1 file changed, 13 insertions(+)
> 
> diff --git a/src/acpi/s3/s3.c b/src/acpi/s3/s3.c
> index 5ec8d5c8..f0582152 100644
> --- a/src/acpi/s3/s3.c
> +++ b/src/acpi/s3/s3.c
> @@ -445,6 +445,19 @@ static int s3_scan_times(
>  				s3_suspend_finish = previous_ts;
>  			continue;
>  		}
> +
> +		/* get log time for s2idle */
> +		if (strstr(txt, "PM: suspend-to-idle")) {
> +			s3_suspend_finish = ts;
> +			continue;
> +		}
> +		if (strstr(txt, "PM: Timekeeping suspended")) {
> +			s3_resume_start = ts;
> +			if (s3_suspend_finish < 0.0)
> +				s3_suspend_finish = previous_ts;
> +			continue;
> +		}
> +
>  		if (strstr(txt, "Restarting tasks ... done")) {
>  			s3_resume_finish = ts;
>  			break;
> 

Acked-by: Colin Ian King <colin.king@canonical.com>
Ivan Hu Nov. 7, 2019, 7:49 a.m. UTC | #2
On 10/31/19 1:55 AM, Alex Hung wrote:
> This is to fix
>
> Suspend/Resume Timings:
>   Could not determine time to suspend.
>   Could not determine time to resume.
>
> to
>
> Suspend/Resume Timings:
>   Suspend: 0.282 seconds.
>   Resume:  1.008 seconds.
>
> Signed-off-by: Alex Hung <alex.hung@canonical.com>
> ---
>  src/acpi/s3/s3.c | 13 +++++++++++++
>  1 file changed, 13 insertions(+)
>
> diff --git a/src/acpi/s3/s3.c b/src/acpi/s3/s3.c
> index 5ec8d5c8..f0582152 100644
> --- a/src/acpi/s3/s3.c
> +++ b/src/acpi/s3/s3.c
> @@ -445,6 +445,19 @@ static int s3_scan_times(
>  				s3_suspend_finish = previous_ts;
>  			continue;
>  		}
> +
> +		/* get log time for s2idle */
> +		if (strstr(txt, "PM: suspend-to-idle")) {
> +			s3_suspend_finish = ts;
> +			continue;
> +		}
> +		if (strstr(txt, "PM: Timekeeping suspended")) {
> +			s3_resume_start = ts;
> +			if (s3_suspend_finish < 0.0)
> +				s3_suspend_finish = previous_ts;
> +			continue;
> +		}
> +
>  		if (strstr(txt, "Restarting tasks ... done")) {
>  			s3_resume_finish = ts;
>  			break;


Acked-by: Ivan Hu <ivan.hu@canonical.com>
diff mbox series

Patch

diff --git a/src/acpi/s3/s3.c b/src/acpi/s3/s3.c
index 5ec8d5c8..f0582152 100644
--- a/src/acpi/s3/s3.c
+++ b/src/acpi/s3/s3.c
@@ -445,6 +445,19 @@  static int s3_scan_times(
 				s3_suspend_finish = previous_ts;
 			continue;
 		}
+
+		/* get log time for s2idle */
+		if (strstr(txt, "PM: suspend-to-idle")) {
+			s3_suspend_finish = ts;
+			continue;
+		}
+		if (strstr(txt, "PM: Timekeeping suspended")) {
+			s3_resume_start = ts;
+			if (s3_suspend_finish < 0.0)
+				s3_suspend_finish = previous_ts;
+			continue;
+		}
+
 		if (strstr(txt, "Restarting tasks ... done")) {
 			s3_resume_finish = ts;
 			break;