pm: do struct timespec copy to decrease api call times.
Signed-off-by: buxiasen <buxiasen@xiaomi.com>
This commit is contained in:
parent
e0396327a2
commit
4197b5aec8
|
@ -57,11 +57,17 @@
|
|||
#ifdef CONFIG_PM_PROCFS
|
||||
static void pm_stats(FAR struct pm_domain_s *dom, int curstate, int newstate)
|
||||
{
|
||||
struct timespec now;
|
||||
struct timespec ts;
|
||||
|
||||
clock_systime_timespec(&ts);
|
||||
clock_systime_timespec(&now);
|
||||
ts = now;
|
||||
clock_timespec_subtract(&ts, &dom->start, &ts);
|
||||
|
||||
/* Update start */
|
||||
|
||||
dom->start = now;
|
||||
|
||||
if (newstate == PM_RESTORE)
|
||||
{
|
||||
/* Wakeup from WFI */
|
||||
|
@ -76,10 +82,6 @@ static void pm_stats(FAR struct pm_domain_s *dom, int curstate, int newstate)
|
|||
clock_timespec_add(&ts, &dom->wake[curstate], &dom->wake[curstate]);
|
||||
dom->in_sleep = true;
|
||||
}
|
||||
|
||||
/* Update start */
|
||||
|
||||
clock_systime_timespec(&dom->start);
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
|
|
Loading…
Reference in New Issue