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

Commit 818ea19d authored by Ytai Ben-Tsvi's avatar Ytai Ben-Tsvi Committed by Automerger Merge Worker
Browse files

Print timestamp lag in SensorPoseProvider-example am: 879f0910

Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/av/+/15828341

Change-Id: I88f886b717ba3e1d2258974af8029af1f07e7460
parents 8a6a9614 879f0910
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -57,6 +57,7 @@ cc_binary {
        "libheadtracking",
        "libheadtracking-binding",
        "libsensor",
        "libutils",
    ],
}

+8 −1
Original line number Diff line number Diff line
@@ -19,9 +19,11 @@

#include <android/sensor.h>
#include <hardware/sensors.h>
#include <utils/SystemClock.h>

#include <media/SensorPoseProvider.h>

using android::elapsedRealtimeNano;
using android::media::Pose3f;
using android::media::SensorPoseProvider;
using android::media::Twist3f;
@@ -32,7 +34,12 @@ class Listener : public SensorPoseProvider::Listener {
  public:
    void onPose(int64_t timestamp, int32_t handle, const Pose3f& pose,
                const std::optional<Twist3f>& twist) override {
        std::cout << "onPose t=" << timestamp << " sensor=" << handle << " pose=" << pose
        int64_t now = elapsedRealtimeNano();

        std::cout << "onPose t=" << timestamp
                  << " lag=" << ((now - timestamp) / 1e6) << "[ms]"
                  << " sensor=" << handle
                  << " pose=" << pose
                  << " twist=";
        if (twist.has_value()) {
            std::cout << twist.value();