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

Commit 58c1a029 authored by Vova Sharaienko's avatar Vova Sharaienko Committed by Android (Google) Code Review
Browse files

Merge "Removed dependency on libstatslog" into main

parents 01d7b14b 7fa3876e
Loading
Loading
Loading
Loading
+2 −1
Original line number Original line Diff line number Diff line
@@ -143,7 +143,8 @@ cc_defaults {
        "libstatshidl",
        "libstatshidl",
        "libstatspull",
        "libstatspull",
        "libstatssocket",
        "libstatssocket",
        "libstatslog",
        "libstatslog_inputflinger",
        "libstatslog_surfaceflinger",
        "libschedulerservicehidl",
        "libschedulerservicehidl",
        "libsensorservice",
        "libsensorservice",
        "libsensorservicehidl",
        "libsensorservicehidl",
+5 −3
Original line number Original line Diff line number Diff line
@@ -21,7 +21,7 @@
#include <nativehelper/JNIHelp.h>
#include <nativehelper/JNIHelp.h>
#include <stats_event.h>
#include <stats_event.h>
#include <stats_pull_atom_callback.h>
#include <stats_pull_atom_callback.h>
#include <statslog.h>
#include <statslog_surfaceflinger.h>


#include "stats/SurfaceFlingerPuller.h"
#include "stats/SurfaceFlingerPuller.h"


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


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


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


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


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


    switch (atomTag) {
    switch (atomTag) {
        case android::util::SURFACEFLINGER_STATS_GLOBAL_INFO:
        case android::surfaceflinger::stats::SURFACEFLINGER_STATS_GLOBAL_INFO:
            return parseGlobalInfoPull(pullDataProto, data);
            return parseGlobalInfoPull(pullDataProto, data);
        case android::util::SURFACEFLINGER_STATS_LAYER_INFO:
        case android::surfaceflinger::stats::SURFACEFLINGER_STATS_LAYER_INFO:
            return parseLayerInfoPull(pullDataProto, data);
            return parseLayerInfoPull(pullDataProto, data);
        default:
        default:
            ALOGW("Invalid atom id for surfaceflinger pullers: %" PRId32, atomTag);
            ALOGW("Invalid atom id for surfaceflinger pullers: %" PRId32, atomTag);
@@ -92,7 +92,9 @@ AStatsManager_PullAtomCallbackReturn SurfaceFlingerPuller::parseGlobalInfoPull(
            return AStatsManager_PULL_SKIP;
            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.total_frames(), atom.missed_frames(),
                               atom.client_composition_frames(), atom.display_on_millis(),
                               atom.client_composition_frames(), atom.display_on_millis(),
                               atom.animation_millis(), atom.event_connection_count(),
                               atom.animation_millis(), atom.event_connection_count(),
@@ -146,14 +148,15 @@ AStatsManager_PullAtomCallbackReturn SurfaceFlingerPuller::parseLayerInfoPull(
            return AStatsManager_PULL_SKIP;
            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.layer_name().c_str(), atom.total_frames(),
                                      atom.dropped_frames(), present2Present.value(),
                               atom.dropped_frames(), present2Present.value(), post2present.value(),
                                      post2present.value(), acquire2Present.value(),
                               acquire2Present.value(), latch2Present.value(),
                                      latch2Present.value(), desired2Present.value(),
                               desired2Present.value(), post2Acquire.value(),
                                      post2Acquire.value(), atom.late_acquire_frames(),
                               atom.late_acquire_frames(), atom.bad_desired_present_frames(),
                                      atom.bad_desired_present_frames(), atom.uid(),
                               atom.uid(), atom.total_timeline_frames(), atom.total_janky_frames(),
                                      atom.total_timeline_frames(), atom.total_janky_frames(),
                               atom.total_janky_frames_with_long_cpu(),
                               atom.total_janky_frames_with_long_cpu(),
                               atom.total_janky_frames_with_long_gpu(),
                               atom.total_janky_frames_with_long_gpu(),
                               atom.total_janky_frames_sf_unattributed(),
                               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_sf_prediction_error(),
                               atom.total_jank_frames_app_buffer_stuffing(),
                               atom.total_jank_frames_app_buffer_stuffing(),
                               atom.display_refresh_rate_bucket(), atom.render_rate_bucket(),
                               atom.display_refresh_rate_bucket(), atom.render_rate_bucket(),
                                      frameRateVote.value(), appDeadlineMisses.value(),
                               frameRateVote.value(), appDeadlineMisses.value(), atom.game_mode(),
                                      atom.game_mode(), present2PresentDelta.value());
                               present2PresentDelta.value());
    }
    }
    return AStatsManager_PULL_SUCCESS;
    return AStatsManager_PULL_SUCCESS;
}
}