Module: Mesa
Branch: main
Commit: 1082c8ad116814e16113de9c4a7a067d3e5a0e5c
URL:    
http://cgit.freedesktop.org/mesa/mesa/commit/?id=1082c8ad116814e16113de9c4a7a067d3e5a0e5c

Author: Lionel Landwerlin <[email protected]>
Date:   Sat May 21 19:06:16 2022 +0300

pps: print out message when we get the first counters

Mostly for debug purposes, show the first visible counter timestamp.

Signed-off-by: Lionel Landwerlin <[email protected]>
Reviewed-by: Emma Anholt <[email protected]>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16655>

---

 src/tool/pps/pps_datasource.cc | 6 ++++++
 src/tool/pps/pps_datasource.h  | 3 +++
 2 files changed, 9 insertions(+)

diff --git a/src/tool/pps/pps_datasource.cc b/src/tool/pps/pps_datasource.cc
index 088bc7ec975..c7bd4caba36 100644
--- a/src/tool/pps/pps_datasource.cc
+++ b/src/tool/pps/pps_datasource.cc
@@ -100,6 +100,7 @@ void GpuDataSource::OnStart(const StartArgs &args)
    driver->enable_perfcnt(time_to_sleep.count());
 
    state = State::Start;
+   got_first_counters = false;
 
    {
       std::lock_guard<std::mutex> lock(started_m);
@@ -314,6 +315,11 @@ void GpuDataSource::trace(TraceContext &ctx)
             continue;
          }
 
+         if (!got_first_counters) {
+            PPS_LOG("Got first counters at gpu_ts=0x%016lx", gpu_timestamp);
+            got_first_counters = true;
+         }
+
          auto packet = ctx.NewTracePacket();
          packet->set_timestamp_clock_id(driver->gpu_clock_id());
          packet->set_timestamp(gpu_timestamp);
diff --git a/src/tool/pps/pps_datasource.h b/src/tool/pps/pps_datasource.h
index f2946cbd6a5..51174a72a83 100644
--- a/src/tool/pps/pps_datasource.h
+++ b/src/tool/pps/pps_datasource.h
@@ -65,6 +65,9 @@ class GpuDataSource : public 
perfetto::DataSource<GpuDataSource, GpuDataSourceTr
 
    /// GPU timestamp of packet sent with counter descriptors
    uint64_t descriptor_gpu_timestamp = 0;
+
+   /// Used to track the first available counters
+   bool got_first_counters = false;
 };
 
 } // namespace pps

Reply via email to