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

Commit 7fa3876e authored by Vova Sharaienko's avatar Vova Sharaienko
Browse files

Removed dependency on libstatslog

- created dedicated log modules for surfaceflinger

Flag: EXEMPT bugfix
Bug: 402950016
Test: build should pass, refactoring CL existing tests pass
Change-Id: I086710e62210e30e18788f2c6a1f029162d58bae
parent 346557c1
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -143,7 +143,8 @@ cc_defaults {
        "libstatshidl",
        "libstatspull",
        "libstatssocket",
        "libstatslog",
        "libstatslog_inputflinger",
        "libstatslog_surfaceflinger",
        "libschedulerservicehidl",
        "libsensorservice",
        "libsensorservicehidl",
+5 −3
Original line number Diff line number Diff line
@@ -21,7 +21,7 @@
#include <nativehelper/JNIHelp.h>
#include <stats_event.h>
#include <stats_pull_atom_callback.h>
#include <statslog.h>
#include <statslog_surfaceflinger.h>

#include "stats/SurfaceFlingerPuller.h"

@@ -38,10 +38,12 @@ static AStatsManager_PullAtomCallbackReturn onSurfaceFlingerPullCallback(int32_t
static void initializeNativePullers(JNIEnv* env, jobject javaObject) {
    // Surface flinger layer & global info.
    gSurfaceFlingerPuller = server::stats::SurfaceFlingerPuller();
    AStatsManager_setPullAtomCallback(android::util::SURFACEFLINGER_STATS_GLOBAL_INFO,
    AStatsManager_setPullAtomCallback(android::surfaceflinger::stats::
                                              SURFACEFLINGER_STATS_GLOBAL_INFO,
                                      /* metadata= */ nullptr, onSurfaceFlingerPullCallback,
                                      /* cookie= */ nullptr);
    AStatsManager_setPullAtomCallback(android::util::SURFACEFLINGER_STATS_LAYER_INFO,
    AStatsManager_setPullAtomCallback(android::surfaceflinger::stats::
                                              SURFACEFLINGER_STATS_LAYER_INFO,
                                      /* metadata= */ nullptr, onSurfaceFlingerPullCallback,
                                      /* cookie= */ nullptr);
}
+40 −37
Original line number Diff line number Diff line
@@ -20,7 +20,7 @@

#include <gui/SurfaceComposerClient.h>
#include <log/log.h>
#include <statslog.h>
#include <statslog_surfaceflinger.h>
#include <timestatsatomsproto/TimeStatsAtomsProtoHeader.h>

#include <vector>
@@ -29,7 +29,7 @@ namespace android {
namespace server {
namespace stats {

using android::util::BytesField;
using android::surfaceflinger::stats::BytesField;
using std::optional;

namespace {
@@ -58,9 +58,9 @@ AStatsManager_PullAtomCallbackReturn SurfaceFlingerPuller::pull(int32_t atomTag,
    }

    switch (atomTag) {
        case android::util::SURFACEFLINGER_STATS_GLOBAL_INFO:
        case android::surfaceflinger::stats::SURFACEFLINGER_STATS_GLOBAL_INFO:
            return parseGlobalInfoPull(pullDataProto, data);
        case android::util::SURFACEFLINGER_STATS_LAYER_INFO:
        case android::surfaceflinger::stats::SURFACEFLINGER_STATS_LAYER_INFO:
            return parseLayerInfoPull(pullDataProto, data);
        default:
            ALOGW("Invalid atom id for surfaceflinger pullers: %" PRId32, atomTag);
@@ -92,7 +92,9 @@ AStatsManager_PullAtomCallbackReturn SurfaceFlingerPuller::parseGlobalInfoPull(
            return AStatsManager_PULL_SKIP;
        }

        android::util::addAStatsEvent(data, android::util::SURFACEFLINGER_STATS_GLOBAL_INFO,
        android::surfaceflinger::stats::
                addAStatsEvent(data,
                               android::surfaceflinger::stats::SURFACEFLINGER_STATS_GLOBAL_INFO,
                               atom.total_frames(), atom.missed_frames(),
                               atom.client_composition_frames(), atom.display_on_millis(),
                               atom.animation_millis(), atom.event_connection_count(),
@@ -146,14 +148,15 @@ AStatsManager_PullAtomCallbackReturn SurfaceFlingerPuller::parseLayerInfoPull(
            return AStatsManager_PULL_SKIP;
        }

        android::util::addAStatsEvent(data, android::util::SURFACEFLINGER_STATS_LAYER_INFO,
        android::surfaceflinger::stats::
                addAStatsEvent(data,
                               android::surfaceflinger::stats::SURFACEFLINGER_STATS_LAYER_INFO,
                               atom.layer_name().c_str(), atom.total_frames(),
                                      atom.dropped_frames(), present2Present.value(),
                                      post2present.value(), acquire2Present.value(),
                                      latch2Present.value(), desired2Present.value(),
                                      post2Acquire.value(), atom.late_acquire_frames(),
                                      atom.bad_desired_present_frames(), atom.uid(),
                                      atom.total_timeline_frames(), atom.total_janky_frames(),
                               atom.dropped_frames(), present2Present.value(), post2present.value(),
                               acquire2Present.value(), latch2Present.value(),
                               desired2Present.value(), post2Acquire.value(),
                               atom.late_acquire_frames(), atom.bad_desired_present_frames(),
                               atom.uid(), atom.total_timeline_frames(), atom.total_janky_frames(),
                               atom.total_janky_frames_with_long_cpu(),
                               atom.total_janky_frames_with_long_gpu(),
                               atom.total_janky_frames_sf_unattributed(),
@@ -162,8 +165,8 @@ AStatsManager_PullAtomCallbackReturn SurfaceFlingerPuller::parseLayerInfoPull(
                               atom.total_jank_frames_sf_prediction_error(),
                               atom.total_jank_frames_app_buffer_stuffing(),
                               atom.display_refresh_rate_bucket(), atom.render_rate_bucket(),
                                      frameRateVote.value(), appDeadlineMisses.value(),
                                      atom.game_mode(), present2PresentDelta.value());
                               frameRateVote.value(), appDeadlineMisses.value(), atom.game_mode(),
                               present2PresentDelta.value());
    }
    return AStatsManager_PULL_SUCCESS;
}