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

Commit d8402b69 authored by Zim's avatar Zim
Browse files

Improve input event tracing

Added the seq number to the server dispatch and client
received/finished trace events. This will enable correlating server
an and client events for easier input latency tracking/ANR debugging.

As a follow up, I'll consolidate some of the input trace events to
reduce pressure on the ftrace buffer. For now, this change should be
simple enough and low-risk to go into Android U.

Test: Manual
Bug: 285553040

Change-Id: Ic50235cfe854357f0c13ce62b904077355c780b9
parent 76b526c4
Loading
Loading
Loading
Loading
+15 −0
Original line number Diff line number Diff line
@@ -4,6 +4,7 @@
// Provides a shared memory transport for input events.
//
#define LOG_TAG "InputTransport"
#define ATRACE_TAG ATRACE_TAG_INPUT

#include <errno.h>
#include <fcntl.h>
@@ -449,6 +450,13 @@ status_t InputChannel::sendMessage(const InputMessage* msg) {

    ALOGD_IF(DEBUG_CHANNEL_MESSAGES, "channel '%s' ~ sent message of type %s", mName.c_str(),
             ftl::enum_string(msg->header.type).c_str());

    if (ATRACE_ENABLED()) {
        std::string message =
                StringPrintf("sendMessage(inputChannel=%s, seq=0x%" PRIx32 ", type=0x%" PRIx32 ")",
                             mName.c_str(), msg->header.seq, msg->header.type);
        ATRACE_NAME(message.c_str());
    }
    return OK;
}

@@ -484,6 +492,13 @@ status_t InputChannel::receiveMessage(InputMessage* msg) {

    ALOGD_IF(DEBUG_CHANNEL_MESSAGES, "channel '%s' ~ received message of type %s", mName.c_str(),
             ftl::enum_string(msg->header.type).c_str());

    if (ATRACE_ENABLED()) {
        std::string message = StringPrintf("receiveMessage(inputChannel=%s, seq=0x%" PRIx32
                                           ", type=0x%" PRIx32 ")",
                                           mName.c_str(), msg->header.seq, msg->header.type);
        ATRACE_NAME(message.c_str());
    }
    return OK;
}