diff options
| author | 2019-11-13 04:09:18 -0800 | |
|---|---|---|
| committer | 2019-11-13 04:09:18 -0800 | |
| commit | 9d2bdf25354e7dda4185f48afa01b289b48b59d8 (patch) | |
| tree | 9a96eed3bc604441d61ffc1e8d4d0e455993ae44 | |
| parent | baf843bde5f39ec884956fb5cc51bb474f567714 (diff) | |
| parent | 104972e936878217d011a974c0e4a90280531a2d (diff) | |
Merge "[DO NOT MERGE] Log Winscope tracing with the frame composition time"
am: 104972e936
Change-Id: I2f80936a8daffacf73363b6d338f27a16f30a3de
| -rw-r--r-- | services/surfaceflinger/SurfaceFlinger.cpp | 3 | ||||
| -rw-r--r-- | services/surfaceflinger/SurfaceTracing.cpp | 5 | ||||
| -rw-r--r-- | services/surfaceflinger/SurfaceTracing.h | 4 |
3 files changed, 8 insertions, 4 deletions
diff --git a/services/surfaceflinger/SurfaceFlinger.cpp b/services/surfaceflinger/SurfaceFlinger.cpp index 200da2e814..60b3a11754 100644 --- a/services/surfaceflinger/SurfaceFlinger.cpp +++ b/services/surfaceflinger/SurfaceFlinger.cpp @@ -1825,6 +1825,7 @@ void SurfaceFlinger::handleMessageRefresh() { preComposition(); rebuildLayerStacks(); calculateWorkingSet(); + long compositionTime = elapsedRealtimeNano(); for (const auto& [token, display] : mDisplays) { beginFrame(display); prepareFrame(display); @@ -1854,7 +1855,7 @@ void SurfaceFlinger::handleMessageRefresh() { if (mVisibleRegionsDirty) { mVisibleRegionsDirty = false; if (mTracingEnabled) { - mTracing.notify("visibleRegionsDirty"); + mTracing.notify(compositionTime, "visibleRegionsDirty"); } } } diff --git a/services/surfaceflinger/SurfaceTracing.cpp b/services/surfaceflinger/SurfaceTracing.cpp index 9053f2c7de..5d9be0b8a9 100644 --- a/services/surfaceflinger/SurfaceTracing.cpp +++ b/services/surfaceflinger/SurfaceTracing.cpp @@ -68,8 +68,9 @@ bool SurfaceTracing::addTraceToBuffer(LayersTraceProto& entry) { return mEnabled; } -void SurfaceTracing::notify(const char* where) { +void SurfaceTracing::notify(long compositionTime, const char* where) { std::scoped_lock lock(mSfLock); + mCompositionTime = compositionTime; mWhere = where; mCanStartTrace.notify_one(); } @@ -160,7 +161,7 @@ LayersTraceProto SurfaceTracing::traceLayersLocked(const char* where) { ATRACE_CALL(); LayersTraceProto entry; - entry.set_elapsed_realtime_nanos(elapsedRealtimeNano()); + entry.set_elapsed_realtime_nanos(mCompositionTime); entry.set_where(where); LayersProto layers(mFlinger.dumpDrawingStateProto(mTraceFlags)); entry.mutable_layers()->Swap(&layers); diff --git a/services/surfaceflinger/SurfaceTracing.h b/services/surfaceflinger/SurfaceTracing.h index 4773307a65..395d5622c7 100644 --- a/services/surfaceflinger/SurfaceTracing.h +++ b/services/surfaceflinger/SurfaceTracing.h @@ -46,7 +46,7 @@ public: bool disable(); status_t writeToFile(); bool isEnabled() const; - void notify(const char* where); + void notify(long compositionTime, const char* where); void setBufferSize(size_t bufferSizeInByte); void writeToFileAsync(); @@ -81,6 +81,8 @@ private: std::queue<LayersTraceProto> mStorage; }; + long mCompositionTime; + void mainLoop(); void addFirstEntry(); LayersTraceProto traceWhenNotified(); |