summaryrefslogtreecommitdiff
path: root/osi
diff options
context:
space:
mode:
authorAndre Eisenbach <eisenbach@google.com>2016-03-17 16:51:36 -0700
committerAndre Eisenbach <eisenbach@google.com>2016-03-17 16:52:10 -0700
commitf4f3b602395c8961fce5937f8e97a57db276b978 (patch)
treeb60b7a96caa8c5bc9cbf6df6c8c6de0aa45d20a9 /osi
parent1b1bcbb3b0bc812410a3ee4f798570d40e0463bc (diff)
downloadandroid-system-bt-f4f3b602395c8961fce5937f8e97a57db276b978.tar.gz
android-system-bt-f4f3b602395c8961fce5937f8e97a57db276b978.tar.xz
Log error code on wakelock acquisition/release failure
Bug: 27721443 Change-Id: I8ac9e738d916bfdcf125e33c0e09f90cc8d26d55
Diffstat (limited to 'osi')
-rw-r--r--osi/src/wakelock.c26
1 files changed, 17 insertions, 9 deletions
diff --git a/osi/src/wakelock.c b/osi/src/wakelock.c
index bb4709b..ba518eb 100644
--- a/osi/src/wakelock.c
+++ b/osi/src/wakelock.c
@@ -66,6 +66,8 @@ typedef struct {
period_ms_t last_acquired_timestamp_ms;
period_ms_t last_released_timestamp_ms;
period_ms_t last_reset_timestamp_ms;
+ int last_acquired_error;
+ int last_released_error;
} wakelock_stats_t;
static wakelock_stats_t wakelock_stats;
@@ -275,8 +277,10 @@ static void update_wakelock_acquired_stats(bt_status_t acquired_status) {
pthread_mutex_lock(&monitor);
- if (acquired_status != BT_STATUS_SUCCESS)
+ if (acquired_status != BT_STATUS_SUCCESS) {
wakelock_stats.acquired_errors++;
+ wakelock_stats.last_acquired_error = acquired_status;
+ }
if (wakelock_stats.is_acquired) {
pthread_mutex_unlock(&monitor);
@@ -305,8 +309,10 @@ static void update_wakelock_released_stats(bt_status_t released_status) {
pthread_mutex_lock(&monitor);
- if (released_status != BT_STATUS_SUCCESS)
+ if (released_status != BT_STATUS_SUCCESS) {
wakelock_stats.released_errors++;
+ wakelock_stats.last_released_error = released_status;
+ }
if (!wakelock_stats.is_acquired) {
pthread_mutex_unlock(&monitor);
@@ -363,20 +369,22 @@ void wakelock_debug_dump(int fd) {
ave_interval = total_interval / wakelock_stats.acquired_count;
dprintf(fd, "\nBluetooth Wakelock Statistics:\n");
- dprintf(fd, " Wakelock is acquired : %s\n",
+ dprintf(fd, " Is acquired : %s\n",
wakelock_stats.is_acquired? "true" : "false");
- dprintf(fd, " Wakelock acquired/released count : %zu / %zu\n",
+ dprintf(fd, " Acquired/released count : %zu / %zu\n",
wakelock_stats.acquired_count, wakelock_stats.released_count);
- dprintf(fd, " Wakelock acquired/released errors : %zu / %zu\n",
+ dprintf(fd, " Acquired/released error count : %zu / %zu\n",
wakelock_stats.acquired_errors, wakelock_stats.released_errors);
- dprintf(fd, " Wakelock last acquired time (ms) : %llu\n",
+ dprintf(fd, " Last acquire/release error code: %d / %d\n",
+ wakelock_stats.last_acquired_error, wakelock_stats.last_released_error);
+ dprintf(fd, " Last acquired time (ms) : %llu\n",
(unsigned long long)last_interval);
- dprintf(fd, " Wakelock acquired time min/max/avg (ms) : %llu / %llu / %llu\n",
+ dprintf(fd, " Acquired time min/max/avg (ms) : %llu / %llu / %llu\n",
(unsigned long long)min_interval, (unsigned long long)max_interval,
(unsigned long long)ave_interval);
- dprintf(fd, " Wakelock total acquired time (ms) : %llu\n",
+ dprintf(fd, " Total acquired time (ms) : %llu\n",
(unsigned long long)total_interval);
- dprintf(fd, " Bluetooth total run time (ms) : %llu\n",
+ dprintf(fd, " Total run time (ms) : %llu\n",
(unsigned long long)(now_ms - wakelock_stats.last_reset_timestamp_ms));
if (lock_error == 0)