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
Signed-off-by: Sophia Wang <yodagump@google.com>
Change-Id: Idd7c999dcd822cc0f7747baa11ec200eed5f5172
This commit is contained in:
Sophia Wang
2022-07-14 10:26:24 -07:00
parent ace01eaf6b
commit 2957657ac3
3 changed files with 30 additions and 0 deletions

View File

@@ -75,6 +75,7 @@
#include <trace/hooks/snd_compr.h>
#include <trace/hooks/gup.h>
#include <trace/hooks/pci.h>
#include <trace/hooks/suspend.h>
/*
* Export tracepoints that act as a bare tracehook (ie: have no trace event
@@ -404,3 +405,5 @@ EXPORT_TRACEPOINT_SYMBOL_GPL(android_rvh_update_rt_rq_load_avg);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_rvh_pci_d3_sleep);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_rvh_update_rq_clock_pelt);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_rvh_cpumask_any_and_distribute);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_resume_begin);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_resume_end);

View File

@@ -0,0 +1,24 @@
/* 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))
/* 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"
@@ -517,6 +518,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");
@@ -527,6 +529,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: