From a6e70e6bc939eed761241391693e1531b9d4f9d2 Mon Sep 17 00:00:00 2001 From: Lionel Landwerlin Date: Sun, 12 Apr 2020 22:57:42 +0300 Subject: [PATCH 1/2] scripts: don't use i915-perf-recorder if disabled Signed-off-by: Lionel Landwerlin --- sample/trace-cmd-start-tracing.sh | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/sample/trace-cmd-start-tracing.sh b/sample/trace-cmd-start-tracing.sh index 66734d3b..543da464 100755 --- a/sample/trace-cmd-start-tracing.sh +++ b/sample/trace-cmd-start-tracing.sh @@ -83,9 +83,11 @@ if [ -e /tmp/.i915-perf-record ]; then $CMD fi -CMD="i915-perf-recorder -m ${I915_PERF_METRIC} -s 8000 -k ${CLOCK}" -echo $CMD -$CMD & +if [ "${USE_I915_PERF}" ]; then + CMD="i915-perf-recorder -m ${I915_PERF_METRIC} -s 8000 -k ${CLOCK}" + echo $CMD + $CMD & +fi echo ./trace-cmd-status.sh From 83cbecfdd7465c42ab2f7a039df7adf4478a776c Mon Sep 17 00:00:00 2001 From: Lionel Landwerlin Date: Sun, 12 Apr 2020 23:22:15 +0300 Subject: [PATCH 2/2] Rework GPU generated bars color matching A simple thing to color our bars is to use the same color as the process that generated them. We do this after process colors have been allocated and use a default color when there is no associated process. Signed-off-by: Lionel Landwerlin --- src/gpuvis.cpp | 22 ++++++++++++++-------- src/gpuvis.h | 2 -- 2 files changed, 14 insertions(+), 10 deletions(-) diff --git a/src/gpuvis.cpp b/src/gpuvis.cpp index e3afd2ef..b8e16b15 100644 --- a/src/gpuvis.cpp +++ b/src/gpuvis.cpp @@ -2142,20 +2142,26 @@ void TraceEvents::init_i915_perf_event( trace_event_t &event ) } } - m_i915.perf_hw_context_ids.insert( event.pid ); m_i915.perf_locs.push_back( event.id ); } void TraceEvents::update_i915_perf_colors() { - uint32_t n_colors = m_i915.perf_hw_context_ids.size(); - uint32_t idx = 0; + for ( const uint32_t event_id : m_i915.perf_locs ) + { + trace_event_t &i915_perf_event = m_events[ event_id ]; - for ( const uint32_t hw_id : m_i915.perf_hw_context_ids ) { - m_i915.perf_hw_context_colors.insert( - std::make_pair( hw_id, - ImColor::HSV( (float) idx / n_colors, 0.8f, 0.8f ) ) ); - idx++; + if ( m_i915.perf_to_req_in.m_map.find( i915_perf_event.id ) == m_i915.perf_to_req_in.m_map.end() ) + { + i915_perf_event.color = s_clrs().get( col_Graph_Bari915Execute ); + } + else + { + uint32_t tg_event_id = m_i915.perf_to_req_in.m_map[ i915_perf_event.id ]; + const trace_event_t &tg_event = m_events[ tg_event_id ]; + + i915_perf_event.color = tg_event.color; + } } } diff --git a/src/gpuvis.h b/src/gpuvis.h index 1335e063..7d36b2ff 100644 --- a/src/gpuvis.h +++ b/src/gpuvis.h @@ -535,8 +535,6 @@ class TraceEvents std::vector< uint32_t > perf_locs; // i915-perf-begin event to i915_request_in util_umap< uint32_t, uint32_t > perf_to_req_in; - // i915-perf HW context ID - std::unordered_set< uint32_t > perf_hw_context_ids; // Maps a HW context ID to its color std::map< uint32_t, ImU32 > perf_hw_context_colors; } m_i915;