From patchwork Mon Jul 22 10:11:49 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: James Clark X-Patchwork-Id: 13738638 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 5B705C3DA5D for ; Mon, 22 Jul 2024 10:15:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From: Reply-To:Content-Type:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=22WWYz2tUVGtuasGpu3eN+nV++HsU5p2cQus0dyDbEs=; b=gud7NYuXTbDdJUFtWEmzFXNEWC I7ADj1PjTdSe+IkRDdocpGxmi7y6GxQsD3HMvh6qVA64oZJ//JDdwAv178H4s3H1+RHgXGYOq5bsT 9ftfqETVqWJBWzIEFIqOain2Br0EjDVM/rl9hidPem0rdEk+uejUgst35cwWOEBhhLkIuOCoOwpG4 SGcncawXOcKtgz9vcK5+Uzo6cIWMYPQvLVgUcGJ5oIL4ytIrSZRDaicm9lNqRYOWqkoWZit9nyfYf sNKnyWFwHI7OEk1lYie9c1B+ffVyGOoE2kDFF577T0tK09MdD8m8OCsJnE7WTrfK2nYKSZMuwm3qm GE6FPovw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sVq4y-00000009DHe-0OLn; Mon, 22 Jul 2024 10:15:40 +0000 Received: from mail-lj1-x22e.google.com ([2a00:1450:4864:20::22e]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sVq2S-00000009CJp-2wie for linux-arm-kernel@lists.infradead.org; Mon, 22 Jul 2024 10:13:06 +0000 Received: by mail-lj1-x22e.google.com with SMTP id 38308e7fff4ca-2ee9b098bd5so53331231fa.0 for ; Mon, 22 Jul 2024 03:13:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1721643183; x=1722247983; darn=lists.infradead.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=22WWYz2tUVGtuasGpu3eN+nV++HsU5p2cQus0dyDbEs=; b=bYvEUIiuts3APB9HIbHzZPGIOUpGDFtwo0WszpFb7r9IizFBmsx5R/IVRuiRrAOBTq qaQHMTvygf4I63Mu89SGNwIJYH1+JTYFwhsy3j5W/OSSbqBwuFaOppRpFDJNalncAONd Q3oa6SWhb65E9aBC8cIm0BiMUAGlMvA0DGoV9zKNo4lk2pac4hXbBhG/QUixojonfEfo WllslBombEELyMRhXgR8XtAq1loKwPOs87Vbho+s8cT1U8drBNsNYaSiZTGw1sxVwE8K 8pRn3Uv2aQtLzegR9nj26hg1t5RxDAUJSc2RD64M2/XxwpJaF2zzHXThZI0a8yEC+AQM rNPg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1721643183; x=1722247983; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=22WWYz2tUVGtuasGpu3eN+nV++HsU5p2cQus0dyDbEs=; b=Z5Es7vM5oiDn/+j0OACDwO3ijyhXeKvacdsjgazf2wllTiL6EWi+gMzdNoVzZD7Fve 4TWP7szuhrRZr2pyEljdnrlutU72AAdsz7gH56bRs7A6urvPGN6VCLF4V7LNiW/WJ83t lxdE/5x+xr6Buc2t/vgxDtu6MxRxMsfVk0Ro2LZhlvNCRNW3ycWlWlQPN5DhfsHEYnGs tPJcREfNZSQGruKyGUI3S8cS8ZGA9FuIO/74QPDUWqtRlsMUODEdL6X/L0gq9pBhM4cJ sfNUaMZEZUtQJNF5BKuYxVPuxMegCiquUo0PQcWLUdBsG0Q/fONV2oYBLQBCcUFiGS26 0JBg== X-Forwarded-Encrypted: i=1; AJvYcCWGAj7jucLbczg2nULZqqnH938Sy0wpmKernoXkgPAksFWK6yxf8yFEI3MahQjvAJ/L5I6v1/cN8UsA4vjE638wILOtdeESxd3s6J8Z4CjcNurFSkQ= X-Gm-Message-State: AOJu0YzU4XKruS8TnlpNO6jNbz1JiGbz+0sswJoXU5NHaoeHLzMS5SQP UwbSIBlBOHTCgvWGUXbcbZepOI6IIEhfhCE51/QRI5EkLTsMc74a0HcfL0CPfE4= X-Google-Smtp-Source: AGHT+IGUJY+LiEZGDA07U+K/qkfthMc8al4V942XRBG+OJuyhgexjuNQfTeA3mz1e0/Ia/+b/eMfWw== X-Received: by 2002:a2e:8059:0:b0:2ef:24e0:6338 with SMTP id 38308e7fff4ca-2ef24e06429mr37487261fa.27.1721643183124; Mon, 22 Jul 2024 03:13:03 -0700 (PDT) Received: from localhost.localdomain ([89.47.253.130]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-427d2a8e436sm147993865e9.33.2024.07.22.03.13.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 22 Jul 2024 03:13:02 -0700 (PDT) From: James Clark To: coresight@lists.linaro.org, suzuki.poulose@arm.com, gankulkarni@os.amperecomputing.com, mike.leach@linaro.org, leo.yan@linux.dev, anshuman.khandual@arm.com Cc: James Clark , James Clark , Alexander Shishkin , Maxime Coquelin , Alexandre Torgue , John Garry , Will Deacon , Peter Zijlstra , Ingo Molnar , Arnaldo Carvalho de Melo , Namhyung Kim , Mark Rutland , Jiri Olsa , Ian Rogers , Adrian Hunter , "Liang, Kan" , linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-stm32@st-md-mailman.stormreply.com, linux-perf-users@vger.kernel.org Subject: [PATCH v6 07/17] perf: cs-etm: Print queue number in raw trace dump Date: Mon, 22 Jul 2024 11:11:49 +0100 Message-Id: <20240722101202.26915-8-james.clark@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240722101202.26915-1-james.clark@linaro.org> References: <20240722101202.26915-1-james.clark@linaro.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240722_031304_782654_896B3A51 X-CRM114-Status: GOOD ( 18.57 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org From: James Clark Now that we have overlapping trace IDs it's also useful to know what the queue number is to be able to distinguish the source of the trace so print it inline. Hide it behind the -v option because it might not be obvious to users what the queue number is. Signed-off-by: James Clark Signed-off-by: James Clark Reviewed-by: Mike Leach --- tools/perf/util/cs-etm-decoder/cs-etm-decoder.c | 4 ++-- tools/perf/util/cs-etm-decoder/cs-etm-decoder.h | 2 +- tools/perf/util/cs-etm.c | 13 ++++++++++--- 3 files changed, 13 insertions(+), 6 deletions(-) diff --git a/tools/perf/util/cs-etm-decoder/cs-etm-decoder.c b/tools/perf/util/cs-etm-decoder/cs-etm-decoder.c index d49c3e9c7c21..b78ef0262135 100644 --- a/tools/perf/util/cs-etm-decoder/cs-etm-decoder.c +++ b/tools/perf/util/cs-etm-decoder/cs-etm-decoder.c @@ -41,7 +41,7 @@ const u32 INSTR_PER_NS = 10; struct cs_etm_decoder { void *data; - void (*packet_printer)(const char *msg); + void (*packet_printer)(const char *msg, void *data); bool suppress_printing; dcd_tree_handle_t dcd_tree; cs_etm_mem_cb_type mem_access; @@ -202,7 +202,7 @@ static void cs_etm_decoder__print_str_cb(const void *p_context, const struct cs_etm_decoder *decoder = p_context; if (p_context && str_len && !decoder->suppress_printing) - decoder->packet_printer(msg); + decoder->packet_printer(msg, decoder->data); } static int diff --git a/tools/perf/util/cs-etm-decoder/cs-etm-decoder.h b/tools/perf/util/cs-etm-decoder/cs-etm-decoder.h index 272c2efe78ee..12c782fa6db2 100644 --- a/tools/perf/util/cs-etm-decoder/cs-etm-decoder.h +++ b/tools/perf/util/cs-etm-decoder/cs-etm-decoder.h @@ -60,7 +60,7 @@ struct cs_etm_trace_params { struct cs_etm_decoder_params { int operation; - void (*packet_printer)(const char *msg); + void (*packet_printer)(const char *msg, void *data); cs_etm_mem_cb_type mem_acc_cb; bool formatted; bool fsyncs; diff --git a/tools/perf/util/cs-etm.c b/tools/perf/util/cs-etm.c index b11b0cae608e..6298a5c7a651 100644 --- a/tools/perf/util/cs-etm.c +++ b/tools/perf/util/cs-etm.c @@ -762,15 +762,22 @@ static void cs_etm__packet_swap(struct cs_etm_auxtrace *etm, } } -static void cs_etm__packet_dump(const char *pkt_string) +static void cs_etm__packet_dump(const char *pkt_string, void *data) { const char *color = PERF_COLOR_BLUE; int len = strlen(pkt_string); + struct cs_etm_queue *etmq = data; + char queue_nr[64]; + + if (verbose) + snprintf(queue_nr, sizeof(queue_nr), "Qnr:%d; ", etmq->queue_nr); + else + queue_nr[0] = '\0'; if (len && (pkt_string[len-1] == '\n')) - color_fprintf(stdout, color, " %s", pkt_string); + color_fprintf(stdout, color, " %s%s", queue_nr, pkt_string); else - color_fprintf(stdout, color, " %s\n", pkt_string); + color_fprintf(stdout, color, " %s%s\n", queue_nr, pkt_string); fflush(stdout); }