From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) by gabe.freedesktop.org (Postfix) with ESMTPS id 0BF866E3D3 for ; Thu, 7 Jan 2021 01:07:26 +0000 (UTC) Date: Wed, 6 Jan 2021 17:07:16 -0800 From: Umesh Nerlige Ramappa Message-ID: <20210107010716.GF71919@orsosgc001.ra.intel.com> References: <20201228031940.178954-1-lionel.g.landwerlin@intel.com> <20201228031940.178954-4-lionel.g.landwerlin@intel.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20201228031940.178954-4-lionel.g.landwerlin@intel.com> Subject: Re: [igt-dev] [PATCH i-g-t 4/4] lib/i915/perf: don't forget last timeline element List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="us-ascii"; Format="flowed" Errors-To: igt-dev-bounces@lists.freedesktop.org Sender: "igt-dev" To: Lionel Landwerlin Cc: igt-dev@lists.freedesktop.org List-ID: On Mon, Dec 28, 2020 at 05:19:40AM +0200, Lionel Landwerlin wrote: >We're currently dropping the last element of the timeline. Inside the for-loop we append timeline events on context switches indicating what context ran and for how long, but that's not the case for the append_timeline_event outside the for-loop. Does the one outside indicate how long last_ctx_id ran before capture ended (or we ran out of records)? Is it possible for the user to distinguish the two? Just thinking out loud. Otherwise: Reviewed-by: Umesh Nerlige Ramappa Thanks, Umesh > >Signed-off-by: Lionel Landwerlin >Fixes: 43116ee368585d ("lib/i915-perf: add i915 perf data reader") >--- > lib/i915/perf_data_reader.c | 27 ++++++++++++++++++--------- > 1 file changed, 18 insertions(+), 9 deletions(-) > >diff --git a/lib/i915/perf_data_reader.c b/lib/i915/perf_data_reader.c >index 4b68fb502..065fe6066 100644 >--- a/lib/i915/perf_data_reader.c >+++ b/lib/i915/perf_data_reader.c >@@ -298,17 +298,23 @@ static void > generate_cpu_events(struct intel_perf_data_reader *reader) > { > uint32_t last_header_idx = 0; >- const struct drm_i915_perf_record_header *last_header = reader->records[0]; >+ const struct drm_i915_perf_record_header *last_header = reader->records[0], >+ *current_header = reader->records[0]; >+ const uint8_t *start_report, *end_report; >+ uint32_t last_ctx_id, current_ctx_id; >+ uint64_t gpu_ts_start, gpu_ts_end; > > for (uint32_t i = 1; i < reader->n_records; i++) { >- const struct drm_i915_perf_record_header *current_header = >- reader->records[i]; >- const uint8_t *start_report = (const uint8_t *) (last_header + 1), >- *end_report = (const uint8_t *) (current_header + 1); >- uint32_t last_ctx_id = oa_report_ctx_id(&reader->devinfo, start_report), >- current_ctx_id = oa_report_ctx_id(&reader->devinfo, end_report); >- uint64_t gpu_ts_start = oa_report_timestamp(start_report), >- gpu_ts_end = oa_report_timestamp(end_report); >+ current_header = reader->records[i]; >+ >+ start_report = (const uint8_t *) (last_header + 1); >+ end_report = (const uint8_t *) (current_header + 1); >+ >+ last_ctx_id = oa_report_ctx_id(&reader->devinfo, start_report); >+ current_ctx_id = oa_report_ctx_id(&reader->devinfo, end_report); >+ >+ gpu_ts_start = oa_report_timestamp(start_report); >+ gpu_ts_end = oa_report_timestamp(end_report); > > if (last_ctx_id == current_ctx_id) > continue; >@@ -318,6 +324,9 @@ generate_cpu_events(struct intel_perf_data_reader *reader) > last_header = current_header; > last_header_idx = i; > } >+ >+ if (last_header != current_header) >+ append_timeline_event(reader, gpu_ts_start, gpu_ts_end, last_header_idx, reader->n_records - 1, last_ctx_id); > } > > static void >-- >2.30.0.rc2 > _______________________________________________ igt-dev mailing list igt-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/igt-dev