ANDROID: power: Add vendor hook for suspend

The purpose of this vendor hook is to calculating
the total resume latency for device, CPU and
console, etc. Current vendor hook only supports
individual resume latency for device, each individual
CPU, etc, but lacking of the total resume latency tracing.

Bug: 232541623
Change-Id: Idd7c999dcd822cc0f7747baa11ec200eed5f5172
Signed-off-by: Sophia Wang <yodagump@google.com>
Signed-off-by: Rick Yiu <rickyiu@google.com>
Signed-off-by: Will McVicker <willmcvicker@google.com>
This commit is contained in:
Rick Yiu
2023-10-18 07:07:48 +00:00
parent 7a02c9f4a3
commit 258557effa
3 changed files with 36 additions and 0 deletions

View File

@@ -72,6 +72,7 @@
#include <trace/hooks/fsnotify.h>
#include <trace/hooks/fuse.h>
#include <trace/hooks/ogki_honor.h>
#include <trace/hooks/suspend.h>
/*
* Export tracepoints that act as a bare tracehook (ie: have no trace event
@@ -554,3 +555,6 @@ EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_swap_writepage);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_shrink_node_memcgs);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_mmap_region);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_try_to_unmap_one);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_resume_begin);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_resume_end);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_early_resume_begin);

View File

@@ -0,0 +1,28 @@
/* SPDX-License-Identifier: GPL-2.0 */
#undef TRACE_SYSTEM
#define TRACE_SYSTEM suspend
#define TRACE_INCLUDE_PATH trace/hooks
#if !defined(_TRACE_HOOK_SUSPEND_H) || defined(TRACE_HEADER_MULTI_READ)
#define _TRACE_HOOK_SUSPEND_H
#include <trace/hooks/vendor_hooks.h>
DECLARE_HOOK(android_vh_resume_begin,
TP_PROTO(void *unused),
TP_ARGS(unused));
DECLARE_HOOK(android_vh_resume_end,
TP_PROTO(void *unused),
TP_ARGS(unused));
DECLARE_HOOK(android_vh_early_resume_begin,
TP_PROTO(void *unused),
TP_ARGS(unused));
/* macro versions of hooks are no longer required */
#endif /* _TRACE_HOOK_SUSPEND_H */
/* This part must be outside protection */
#include <trace/define_trace.h>

View File

@@ -31,6 +31,7 @@
#include <linux/compiler.h>
#include <linux/moduleparam.h>
#include <linux/wakeup_reason.h>
#include <trace/hooks/suspend.h>
#include "power.h"
@@ -466,6 +467,7 @@ static int suspend_enter(suspend_state_t state, bool *wakeup)
error = suspend_ops->enter(state);
trace_suspend_resume(TPS("machine_suspend"),
state, false);
trace_android_vh_early_resume_begin(NULL);
} else if (*wakeup) {
error = -EBUSY;
}
@@ -534,6 +536,7 @@ int suspend_devices_and_enter(suspend_state_t state)
} while (!error && !wakeup && platform_suspend_again(state));
Resume_devices:
trace_android_vh_resume_begin(NULL);
suspend_test_start();
dpm_resume_end(PMSG_RESUME);
suspend_test_finish("resume devices");
@@ -544,6 +547,7 @@ int suspend_devices_and_enter(suspend_state_t state)
Close:
platform_resume_end(state);
pm_suspend_target_state = PM_SUSPEND_ON;
trace_android_vh_resume_end(NULL);
return error;
Recover_platform: