wil6210: add statistics for suspend time
Add statistics for total, min and max suspend time, that calculates the time the 11ad device was in suspend. Those statistics will help to estimate the power impact of d3hot feature. Signed-off-by: Maya Erez <qca_merez@qca.qualcomm.com> Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
This commit is contained in:
@@ -300,6 +300,9 @@ int wil_suspend(struct wil6210_priv *wil, bool is_runtime)
|
||||
wil_dbg_pm(wil, "suspend: %s => %d\n",
|
||||
is_runtime ? "runtime" : "system", rc);
|
||||
|
||||
if (!rc)
|
||||
wil->suspend_stats.suspend_start_time = ktime_get();
|
||||
|
||||
return rc;
|
||||
}
|
||||
|
||||
@@ -309,6 +312,7 @@ int wil_resume(struct wil6210_priv *wil, bool is_runtime)
|
||||
struct net_device *ndev = wil_to_ndev(wil);
|
||||
bool keep_radio_on = ndev->flags & IFF_UP &&
|
||||
wil->keep_radio_on_during_sleep;
|
||||
unsigned long long suspend_time_usec = 0;
|
||||
|
||||
wil_dbg_pm(wil, "resume: %s\n", is_runtime ? "runtime" : "system");
|
||||
|
||||
@@ -326,8 +330,20 @@ int wil_resume(struct wil6210_priv *wil, bool is_runtime)
|
||||
else
|
||||
rc = wil_resume_radio_off(wil);
|
||||
|
||||
if (rc)
|
||||
goto out;
|
||||
|
||||
suspend_time_usec =
|
||||
ktime_to_us(ktime_sub(ktime_get(),
|
||||
wil->suspend_stats.suspend_start_time));
|
||||
wil->suspend_stats.total_suspend_time += suspend_time_usec;
|
||||
if (suspend_time_usec < wil->suspend_stats.min_suspend_time)
|
||||
wil->suspend_stats.min_suspend_time = suspend_time_usec;
|
||||
if (suspend_time_usec > wil->suspend_stats.max_suspend_time)
|
||||
wil->suspend_stats.max_suspend_time = suspend_time_usec;
|
||||
|
||||
out:
|
||||
wil_dbg_pm(wil, "resume: %s => %d\n",
|
||||
is_runtime ? "runtime" : "system", rc);
|
||||
wil_dbg_pm(wil, "resume: %s => %d, suspend time %lld usec\n",
|
||||
is_runtime ? "runtime" : "system", rc, suspend_time_usec);
|
||||
return rc;
|
||||
}
|
||||
|
Reference in New Issue
Block a user