From df8228353078f56291847b0cc1c9ee69ad3364fd Mon Sep 17 00:00:00 2001 From: Andrew Levans <121060410+ALevansSamsung@users.noreply.github.com> Date: Fri, 17 May 2024 10:43:53 -0500 Subject: [PATCH] tp: Disable mali events for now (#111) It seems like it is not correct to add at least some of these slices in the normal thread slice track since they are not guaranteed to be correctly nested with respect to atrace. Before: https://screenshot.googleplex.com/5uFn52eTsahdP89 After: https://screenshot.googleplex.com/BSPbWvVLZrWWkTs Change-Id: Ib320ff4a0fa0bcaed10c5fae2481af41ecb2cdbb Bug: 294866695 Co-authored-by: Hector Dearman --- .../ftrace/mali_gpu_event_tracker.cc | 16 +- .../diff_tests/graphics/tests.py | 201 +++++++++--------- 2 files changed, 115 insertions(+), 102 deletions(-) diff --git a/src/trace_processor/importers/ftrace/mali_gpu_event_tracker.cc b/src/trace_processor/importers/ftrace/mali_gpu_event_tracker.cc index 406479764f..088dbb5a7d 100644 --- a/src/trace_processor/importers/ftrace/mali_gpu_event_tracker.cc +++ b/src/trace_processor/importers/ftrace/mali_gpu_event_tracker.cc @@ -47,6 +47,15 @@ void MaliGpuEventTracker::ParseMaliGpuEvent(int64_t ts, uint32_t pid) { using protos::pbzero::FtraceEvent; + // It seems like it is not correct to add to add any of these slices + // in the normal thread slice track since they are not guaranteed to + // be correctly nested with respect to atrace events. + // For now just disable all mali events by early returning here. + // TODO(b/294866695): Consider how to best visualise these events. + if (ts != 0) { + return; + } + UniqueTid utid = context_->process_tracker->GetOrCreateThread(pid); TrackId track_id = context_->track_tracker->InternThreadTrack(utid); @@ -117,8 +126,11 @@ void MaliGpuEventTracker::ParseMaliKcpuCqsSet(int64_t timestamp, mali_KCPU_CQS_SET_id_, 0); } -void MaliGpuEventTracker::ParseMaliKcpuCqsWaitStart(int64_t timestamp, - TrackId track_id) { +PERFETTO_NORETURN void MaliGpuEventTracker::ParseMaliKcpuCqsWaitStart( + int64_t timestamp, + TrackId track_id) { + // TODO(b/294866695): Remove + PERFETTO_FATAL("This causes incorrectly nested slices at present."); context_->slice_tracker->Begin(timestamp, track_id, kNullStringId, mali_KCPU_CQS_WAIT_id_); } diff --git a/test/trace_processor/diff_tests/graphics/tests.py b/test/trace_processor/diff_tests/graphics/tests.py index 7ab6c89012..04a86bd7b1 100644 --- a/test/trace_processor/diff_tests/graphics/tests.py +++ b/test/trace_processor/diff_tests/graphics/tests.py @@ -391,105 +391,106 @@ def test_virtio_gpu(self): 1345090746311,1167135,"CTX_DETACH_RESOURCE" """)) + # TODO(b/294866695): Reenable # mali GPU events - def test_mali(self): - return DiffTestBlueprint( - trace=TextProto(r""" - packet { - ftrace_events { - cpu: 2 - event { - timestamp: 751796307210 - pid: 2857 - mali_mali_KCPU_CQS_WAIT_START { - info_val1: 1 - info_val2: 0 - kctx_tgid: 2201 - kctx_id: 10 - id: 0 - } - } - event { - timestamp: 751800621175 - pid: 2857 - mali_mali_KCPU_CQS_WAIT_END { - info_val1: 412313493488 - info_val2: 0 - kctx_tgid: 2201 - kctx_id: 10 - id: 0 - } - } - event { - timestamp: 751800638997 - pid: 2857 - mali_mali_KCPU_CQS_SET { - info_val1: 412313493480 - info_val2: 0 - kctx_tgid: 2201 - kctx_id: 10 - id: 0 - } - } - } - } - """), - query=""" - SELECT ts, dur, name FROM slice WHERE name GLOB "mali_KCPU_CQS*"; - """, - out=Csv(""" - "ts","dur","name" - 751796307210,4313965,"mali_KCPU_CQS_WAIT" - 751800638997,0,"mali_KCPU_CQS_SET" - """)) + #def test_mali(self): + # return DiffTestBlueprint( + # trace=TextProto(r""" + # packet { + # ftrace_events { + # cpu: 2 + # event { + # timestamp: 751796307210 + # pid: 2857 + # mali_mali_KCPU_CQS_WAIT_START { + # info_val1: 1 + # info_val2: 0 + # kctx_tgid: 2201 + # kctx_id: 10 + # id: 0 + # } + # } + # event { + # timestamp: 751800621175 + # pid: 2857 + # mali_mali_KCPU_CQS_WAIT_END { + # info_val1: 412313493488 + # info_val2: 0 + # kctx_tgid: 2201 + # kctx_id: 10 + # id: 0 + # } + # } + # event { + # timestamp: 751800638997 + # pid: 2857 + # mali_mali_KCPU_CQS_SET { + # info_val1: 412313493480 + # info_val2: 0 + # kctx_tgid: 2201 + # kctx_id: 10 + # id: 0 + # } + # } + # } + # } + # """), + # query=""" + # SELECT ts, dur, name FROM slice WHERE name GLOB "mali_KCPU_CQS*"; + # """, + # out=Csv(""" + # "ts","dur","name" + # 751796307210,4313965,"mali_KCPU_CQS_WAIT" + # 751800638997,0,"mali_KCPU_CQS_SET" + # """)) - def test_mali_fence(self): - return DiffTestBlueprint( - trace=TextProto(r""" - packet { - ftrace_events { - cpu: 2 - event { - timestamp: 751796307210 - pid: 2857 - mali_mali_KCPU_FENCE_WAIT_START { - info_val1: 1 - info_val2: 0 - kctx_tgid: 2201 - kctx_id: 10 - id: 0 - } - } - event { - timestamp: 751800621175 - pid: 2857 - mali_mali_KCPU_FENCE_WAIT_END { - info_val1: 412313493488 - info_val2: 0 - kctx_tgid: 2201 - kctx_id: 10 - id: 0 - } - } - event { - timestamp: 751800638997 - pid: 2857 - mali_mali_KCPU_FENCE_SIGNAL { - info_val1: 412313493480 - info_val2: 0 - kctx_tgid: 2201 - kctx_id: 10 - id: 0 - } - } - } - } - """), - query=""" - SELECT ts, dur, name FROM slice WHERE name GLOB "mali_KCPU_FENCE*"; - """, - out=Csv(""" - "ts","dur","name" - 751796307210,4313965,"mali_KCPU_FENCE_WAIT" - 751800638997,0,"mali_KCPU_FENCE_SIGNAL" - """)) + #def test_mali_fence(self): + # return DiffTestBlueprint( + # trace=TextProto(r""" + # packet { + # ftrace_events { + # cpu: 2 + # event { + # timestamp: 751796307210 + # pid: 2857 + # mali_mali_KCPU_FENCE_WAIT_START { + # info_val1: 1 + # info_val2: 0 + # kctx_tgid: 2201 + # kctx_id: 10 + # id: 0 + # } + # } + # event { + # timestamp: 751800621175 + # pid: 2857 + # mali_mali_KCPU_FENCE_WAIT_END { + # info_val1: 412313493488 + # info_val2: 0 + # kctx_tgid: 2201 + # kctx_id: 10 + # id: 0 + # } + # } + # event { + # timestamp: 751800638997 + # pid: 2857 + # mali_mali_KCPU_FENCE_SIGNAL { + # info_val1: 412313493480 + # info_val2: 0 + # kctx_tgid: 2201 + # kctx_id: 10 + # id: 0 + # } + # } + # } + # } + # """), + # query=""" + # SELECT ts, dur, name FROM slice WHERE name GLOB "mali_KCPU_FENCE*"; + # """, + # out=Csv(""" + # "ts","dur","name" + # 751796307210,4313965,"mali_KCPU_FENCE_WAIT" + # 751800638997,0,"mali_KCPU_FENCE_SIGNAL" + # """))