Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit b18c8f50 authored by Steven Moreland's avatar Steven Moreland Committed by Android (Google) Code Review
Browse files

Merge "libbinder: log too long transactions" into main

parents c724e6ba a4eac455
Loading
Loading
Loading
Loading
+11 −0
Original line number Diff line number Diff line
@@ -41,6 +41,7 @@
#include "Constants.h"
#include "OS.h"
#include "RpcState.h"
#include "Utils.h"

namespace android {

@@ -374,6 +375,8 @@ const String16& BBinder::getInterfaceDescriptor() const
status_t BBinder::transact(
    uint32_t code, const Parcel& data, Parcel* reply, uint32_t flags)
{
    const auto startTime = std::chrono::steady_clock::now();

    data.setDataPosition(0);

    if (reply != nullptr && (flags & FLAG_CLEAR_BUF)) {
@@ -438,6 +441,14 @@ status_t BBinder::transact(
        }
    }

    const uint64_t transactionMs = to_ms(std::chrono::steady_clock::now() - startTime);
    if (transactionMs > 1000lu) {
        ALOGW("Binder transaction to %s code %" PRIu32 " took %" PRIu64
              "ms. Data size: %zu. Reply size: %zu.",
              String8(getInterfaceDescriptor()).c_str(), code, transactionMs, data.dataSize(),
              reply ? reply->dataSize() : 0u);
    }

    return err;
}