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

Commit a9e451a5 authored by Tomasz Wasilczyk's avatar Tomasz Wasilczyk
Browse files

Abstract atrace dependency into binder::os

This is a regression introduced in Iab43329097488f5de531ab9da46893c9df8e46b5

Bug: 302718225
Bug: 341083395
Test: aosp/3081709
Test: mma
Change-Id: I89c9b0f48d20f073619637b31b517a5374bde61e
parent 2265ad9d
Loading
Loading
Loading
Loading
+4 −10
Original line number Diff line number Diff line
@@ -15,7 +15,6 @@
 */

#define LOG_TAG "BpBinder"
#define ATRACE_TAG ATRACE_TAG_AIDL
//#define LOG_NDEBUG 0

#include <binder/BpBinder.h>
@@ -24,15 +23,10 @@
#include <binder/IResultReceiver.h>
#include <binder/RpcSession.h>
#include <binder/Stability.h>
#include <binder/Trace.h>

#include <stdio.h>

#ifndef __TRUSTY__
#include <cutils/trace.h>
#else
#define ATRACE_INT(...)
#endif

#include "BuildFlags.h"
#include "file.h"

@@ -216,7 +210,7 @@ sp<BpBinder> BpBinder::create(int32_t handle) {
        sTrackingMap[trackedUid]++;
    }
    uint32_t numProxies = sBinderProxyCount.fetch_add(1, std::memory_order_relaxed);
    ATRACE_INT("binder_proxies", numProxies);
    binder::os::trace_int(ATRACE_TAG_AIDL, "binder_proxies", numProxies);
    uint32_t numLastWarned = sBinderProxyCountWarned.load(std::memory_order_relaxed);
    uint32_t numNextWarn = numLastWarned + kBinderProxyCountWarnInterval;
    if (numProxies >= numNextWarn) {
@@ -640,8 +634,8 @@ BpBinder::~BpBinder() {
            }
        }
    }
    [[maybe_unused]] uint32_t numProxies = --sBinderProxyCount;
    ATRACE_INT("binder_proxies", numProxies);
    uint32_t numProxies = --sBinderProxyCount;
    binder::os::trace_int(ATRACE_TAG_AIDL, "binder_proxies", numProxies);
    if (ipc) {
        ipc->expungeHandle(binderHandle(), this);
        ipc->decWeakHandle(binderHandle());
+1 −0
Original line number Diff line number Diff line
@@ -26,6 +26,7 @@ namespace android::binder::os {

LIBBINDER_EXPORTED void trace_begin(uint64_t tag, const char* name);
LIBBINDER_EXPORTED void trace_end(uint64_t tag);
LIBBINDER_EXPORTED void trace_int(uint64_t tag, const char* name, int32_t value);

status_t setNonBlocking(borrowed_fd fd);

+4 −0
Original line number Diff line number Diff line
@@ -44,6 +44,10 @@ void trace_end(uint64_t tag) {
    atrace_end(tag);
}

void trace_int(uint64_t tag, const char* name, int32_t value) {
    atrace_int(tag, name, value);
}

} // namespace os

// Legacy trace symbol. To be removed once all of downstream rebuilds.
+2 −0
Original line number Diff line number Diff line
@@ -39,6 +39,8 @@ void trace_begin(uint64_t, const char*) {}

void trace_end(uint64_t) {}

void trace_int(uint64_t, const char*, int32_t) {}

uint64_t GetThreadId() {
    return syscall(__NR_gettid);
}
+1 −0
Original line number Diff line number Diff line
@@ -41,6 +41,7 @@ namespace os {
// libcutils/libutils
void trace_begin(uint64_t tag, const char* name);
void trace_end(uint64_t tag);
void trace_int(uint64_t tag, const char* name, int32_t value);
} // namespace os

class LIBBINDER_EXPORTED ScopedTrace {
Loading