From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id C7FF9358D10 for ; Fri, 5 Dec 2025 15:19:55 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.133.124 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1764948000; cv=none; b=u/fbYGGn7OrlwaVlcF8JPkP4zkXW/jvSixwmuPg3kmgVEaGzdsh6FrtO6wTgo24mlt0DPQTbLZ80aYF2vdLDm9hYHybbVPmberOssDeIN0HHoXfyzSLbfZoV+bqE//u5mlumbNgaRLIeIxrcvHUIjHF+e28S2yafDTE+6sUnIUY= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1764948000; c=relaxed/simple; bh=Ge+xHcYscy7hibFPQ5CR6Kcj7CI8bXEYe8XIup/ucVQ=; h=From:To:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=fjrcPM/rcEP6GXH+UAhDZpOsFiesSwWpLk5/2g4COJ/e9PrC1BqjWqUUPtFMKC13OJHZbG/6d4Hv8JO2Eah/LHNKj3csFYvDa56EIcvsNce+VL+1yf4Tj0h22YXumvoAPTdnL3COsULgZczqPYEljGEiDbOtGjJYYujz0h31XtY= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b=Etp31rQt; dkim=pass (2048-bit key) header.d=redhat.com header.i=@redhat.com header.b=m1W7ZSel; arc=none smtp.client-ip=170.10.133.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="Etp31rQt"; dkim=pass (2048-bit key) header.d=redhat.com header.i=@redhat.com header.b="m1W7ZSel" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1764947993; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=GRPU8uLPrnJcp2kzXwNUa4bZReRP3QAAdFafUOJXZZY=; b=Etp31rQt0LHHFsrta2m3RIQPs0hiav/m9s2+lYkufjtNTGh/VgHOntEjPfQMfrgrPamNSa CNFTzSvlpZbBydQcoyfTvfSXkVzOr5KiQL5NfpIS5fPYpSleJyWdaM5pYr4EO8Oz0ftHPd hYo00nhwfTtJnbTmRBLoVYJqxkeNGvU= Received: from mail-wm1-f72.google.com (mail-wm1-f72.google.com [209.85.128.72]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-168-ESHwuHdxNG67EvlNkATT8Q-1; Fri, 05 Dec 2025 10:19:52 -0500 X-MC-Unique: ESHwuHdxNG67EvlNkATT8Q-1 X-Mimecast-MFC-AGG-ID: ESHwuHdxNG67EvlNkATT8Q_1764947991 Received: by mail-wm1-f72.google.com with SMTP id 5b1f17b1804b1-477cf25ceccso23371595e9.0 for ; Fri, 05 Dec 2025 07:19:52 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=google; t=1764947991; x=1765552791; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=GRPU8uLPrnJcp2kzXwNUa4bZReRP3QAAdFafUOJXZZY=; b=m1W7ZSelFc3yxsiEkJjQ7vVhdeg1oEgENEoZPGnm38MkJnOh91PCn70gp7mvLk8uxR qhSGhNv9aPYwVkm8fjooH5Fwxdfg59vsb2UJYk1ipvvZedD7o3x4iozCSEeyd/a22+ff p0vkGyZVqn+ocWC+O00v66GZnsY9gZE/LBRnzuQIU44cak09qdLIhiyusUbL/ZrDvhdE gqNGgebinKsV8uNhPyjzIdtl5zaQ4ikNjbIEwo1N607fpDFPjYNnxC/NqrDFVrJs6KSe pxNGRFcOdBM8M1koiuatmfbY/YaLChGeRBF7VLGmUaNFDKUztyOzfPQDmIZMbuolUJKc sd+Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1764947991; x=1765552791; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-gg:x-gm-message-state:from:to :cc:subject:date:message-id:reply-to; bh=GRPU8uLPrnJcp2kzXwNUa4bZReRP3QAAdFafUOJXZZY=; b=qgfEWs9b5SIcZCIk7piZdRCYET2wgAXQ+G/rHjIYJTb7yz+QaeDgPvT1fFVg3H/Hy0 u1HPUWJzYBjvXLQ7V0yqEWI7UPS8dARKHLnNK/WSg7lbQ5KY4TcziNAL59+GEGHlKZpF Vu02E3zpem4RPHelI6YXzFXHB+VSeJlRl1KRY4427+FRq9W3ChkB/+8Tdzv9hW8MJkJk BCfr0FHi9D3Gsx7q3P8LTp3ohAE9TLMRDZqxhmhy+LIW+/yLVHT6SqM9+5uN91djntXN tHLf7CkNH3EXeVRywWsgXhoEXIN7pwVCp4pH3rBU+5a0DWeNNKDwQXBJ5UFB6p3oIeHs Xc6A== X-Forwarded-Encrypted: i=1; AJvYcCXsNRLFddtQSho/DSnFySe8uNAuchN8YQ4GmHsMvwaFvia0m35Yb+p3rE7V9hMIe8NIajlv8C2E3ulcg7Q=@vger.kernel.org X-Gm-Message-State: AOJu0Yxg7ESxcGYScwWi3xERTovgygQD6LX4Dld33CwwAe2dCxQsD2ea /3IDp5Pw3gR4nKItdszOCHpq8zuIf0sk6768Ba6IA4j5lHvJ/pPtXtFx0MS1XZ/9MiAiIDtXuPO 2I+4etvRWhUGfOZk7EQeB0E3DpjXzlmYm7SixnH5mYPXVgvf98AdNTLPBVQowXAD+rQ== X-Gm-Gg: ASbGnct3itlCRCsVfBz3ncISpl9YH3sjXb3TN0AZw0T8Evr/CNjUIR99k1w3Ab1pizn NxYqx8DsqvoV+JSViCLxAS60fYnyWF2CV2zoJBshuVq4gWpUC/WnNETKbQf6dq1TgBj5/5nz6Gs 5lY3LEMGgjhwJ68WeeWw6CbphsLkijWG7QiR04LEvahVlfVsWLZmtBfM/iII3c7grLr/+yq+krE IF+YgBCDTimMqxo1ljkPj2ehLl7W1nRIaexRYPTT03igju8B9NA8Pd6fuT2iNS2o5TX8c4J+6q8 oT95QpKuWbEMYas/XTkLqzhne2QCmup7JlANLoewAaI6UGU6uWRo/nh3cnXh7CtG+SaCZ/sRSgo nEtoFpQAFof05qduANWi9BlX7iBw= X-Received: by 2002:a05:600c:4512:b0:46e:6d5f:f68 with SMTP id 5b1f17b1804b1-4792f25bf1bmr78451505e9.12.1764947990980; Fri, 05 Dec 2025 07:19:50 -0800 (PST) X-Google-Smtp-Source: AGHT+IG9FrEf19wCCSYk50h4PVg7Hgyxf3VtI4DoI+w4TKTX1XWuX3cnM0YvurOs50FiPzx7sDFSRg== X-Received: by 2002:a05:600c:4512:b0:46e:6d5f:f68 with SMTP id 5b1f17b1804b1-4792f25bf1bmr78451045e9.12.1764947990465; Fri, 05 Dec 2025 07:19:50 -0800 (PST) Received: from costa-tp.redhat.com ([2a00:a041:e294:5000:b694:8e49:4f51:966d]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-4792b021cd2sm74880785e9.1.2025.12.05.07.19.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 05 Dec 2025 07:19:49 -0800 (PST) From: Costa Shulyupin To: Steven Rostedt , Tomas Glozar , Crystal Wood , Wander Lairson Costa , Costa Shulyupin , Ivan Pravdin , John Kacur , Tiezhu Yang , linux-trace-kernel@vger.kernel.org, linux-kernel@vger.kernel.org, bpf@vger.kernel.org Subject: [PATCH v1 3/4] tools/rtla: Remove unneeded nr_cpus members Date: Fri, 5 Dec 2025 17:19:23 +0200 Message-ID: <20251205151924.2250142-3-costa.shul@redhat.com> X-Mailer: git-send-email 2.52.0 In-Reply-To: <20251205151924.2250142-1-costa.shul@redhat.com> References: <20251205151924.2250142-1-costa.shul@redhat.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit nr_cpus does not change at runtime, so keeping it in struct members is unnecessary. Use the global nr_cpus instead of struct members. Signed-off-by: Costa Shulyupin --- tools/tracing/rtla/src/osnoise_hist.c | 18 ++++++------ tools/tracing/rtla/src/osnoise_top.c | 3 -- tools/tracing/rtla/src/timerlat_aa.c | 10 +++---- tools/tracing/rtla/src/timerlat_hist.c | 40 ++++++++++++-------------- tools/tracing/rtla/src/timerlat_top.c | 19 ++++++------ 5 files changed, 39 insertions(+), 51 deletions(-) diff --git a/tools/tracing/rtla/src/osnoise_hist.c b/tools/tracing/rtla/src/osnoise_hist.c index ae773334e700..7514b29ec559 100644 --- a/tools/tracing/rtla/src/osnoise_hist.c +++ b/tools/tracing/rtla/src/osnoise_hist.c @@ -30,7 +30,6 @@ struct osnoise_hist_data { struct osnoise_hist_cpu *hist; int entries; int bucket_size; - int nr_cpus; }; /* @@ -42,7 +41,7 @@ osnoise_free_histogram(struct osnoise_hist_data *data) int cpu; /* one histogram for IRQ and one for thread, per CPU */ - for (cpu = 0; cpu < data->nr_cpus; cpu++) { + for (cpu = 0; cpu < nr_cpus; cpu++) { if (data->hist[cpu].samples) free(data->hist[cpu].samples); } @@ -74,7 +73,6 @@ static struct osnoise_hist_data data->entries = entries; data->bucket_size = bucket_size; - data->nr_cpus = nr_cpus; data->hist = calloc(1, sizeof(*data->hist) * nr_cpus); if (!data->hist) @@ -247,7 +245,7 @@ static void osnoise_hist_header(struct osnoise_tool *tool) if (!params->common.hist.no_index) trace_seq_printf(s, "Index"); - for_each_monitored_cpu(cpu, data->nr_cpus, ¶ms->common) { + for_each_monitored_cpu(cpu, nr_cpus, ¶ms->common) { if (!data->hist[cpu].count) continue; @@ -276,7 +274,7 @@ osnoise_print_summary(struct osnoise_params *params, if (!params->common.hist.no_index) trace_seq_printf(trace->seq, "count:"); - for_each_monitored_cpu(cpu, data->nr_cpus, ¶ms->common) { + for_each_monitored_cpu(cpu, nr_cpus, ¶ms->common) { if (!data->hist[cpu].count) continue; @@ -288,7 +286,7 @@ osnoise_print_summary(struct osnoise_params *params, if (!params->common.hist.no_index) trace_seq_printf(trace->seq, "min: "); - for_each_monitored_cpu(cpu, data->nr_cpus, ¶ms->common) { + for_each_monitored_cpu(cpu, nr_cpus, ¶ms->common) { if (!data->hist[cpu].count) continue; @@ -301,7 +299,7 @@ osnoise_print_summary(struct osnoise_params *params, if (!params->common.hist.no_index) trace_seq_printf(trace->seq, "avg: "); - for_each_monitored_cpu(cpu, data->nr_cpus, ¶ms->common) { + for_each_monitored_cpu(cpu, nr_cpus, ¶ms->common) { if (!data->hist[cpu].count) continue; @@ -317,7 +315,7 @@ osnoise_print_summary(struct osnoise_params *params, if (!params->common.hist.no_index) trace_seq_printf(trace->seq, "max: "); - for_each_monitored_cpu(cpu, data->nr_cpus, ¶ms->common) { + for_each_monitored_cpu(cpu, nr_cpus, ¶ms->common) { if (!data->hist[cpu].count) continue; @@ -352,7 +350,7 @@ osnoise_print_stats(struct osnoise_tool *tool) trace_seq_printf(trace->seq, "%-6d", bucket * data->bucket_size); - for_each_monitored_cpu(cpu, data->nr_cpus, ¶ms->common) { + for_each_monitored_cpu(cpu, nr_cpus, ¶ms->common) { if (!data->hist[cpu].count) continue; @@ -388,7 +386,7 @@ osnoise_print_stats(struct osnoise_tool *tool) if (!params->common.hist.no_index) trace_seq_printf(trace->seq, "over: "); - for_each_monitored_cpu(cpu, data->nr_cpus, ¶ms->common) { + for_each_monitored_cpu(cpu, nr_cpus, ¶ms->common) { if (!data->hist[cpu].count) continue; diff --git a/tools/tracing/rtla/src/osnoise_top.c b/tools/tracing/rtla/src/osnoise_top.c index 367a765387c8..e5a13f1bdfb6 100644 --- a/tools/tracing/rtla/src/osnoise_top.c +++ b/tools/tracing/rtla/src/osnoise_top.c @@ -31,7 +31,6 @@ struct osnoise_top_cpu { struct osnoise_top_data { struct osnoise_top_cpu *cpu_data; - int nr_cpus; }; /* @@ -59,8 +58,6 @@ static struct osnoise_top_data *osnoise_alloc_top(void) if (!data) return NULL; - data->nr_cpus = nr_cpus; - /* one set of histograms per CPU */ data->cpu_data = calloc(1, sizeof(*data->cpu_data) * nr_cpus); if (!data->cpu_data) diff --git a/tools/tracing/rtla/src/timerlat_aa.c b/tools/tracing/rtla/src/timerlat_aa.c index 5766d58709eb..59b219a1503e 100644 --- a/tools/tracing/rtla/src/timerlat_aa.c +++ b/tools/tracing/rtla/src/timerlat_aa.c @@ -102,7 +102,6 @@ struct timerlat_aa_data { * The analysis context and system wide view */ struct timerlat_aa_context { - int nr_cpus; int dump_tasks; /* per CPU data */ @@ -738,7 +737,7 @@ void timerlat_auto_analysis(int irq_thresh, int thread_thresh) irq_thresh = irq_thresh * 1000; thread_thresh = thread_thresh * 1000; - for (cpu = 0; cpu < taa_ctx->nr_cpus; cpu++) { + for (cpu = 0; cpu < nr_cpus; cpu++) { taa_data = timerlat_aa_get_data(taa_ctx, cpu); if (irq_thresh && taa_data->tlat_irq_latency >= irq_thresh) { @@ -766,7 +765,7 @@ void timerlat_auto_analysis(int irq_thresh, int thread_thresh) printf("\n"); printf("Printing CPU tasks:\n"); - for (cpu = 0; cpu < taa_ctx->nr_cpus; cpu++) { + for (cpu = 0; cpu < nr_cpus; cpu++) { taa_data = timerlat_aa_get_data(taa_ctx, cpu); tep = taa_ctx->tool->trace.tep; @@ -792,7 +791,7 @@ static void timerlat_aa_destroy_seqs(struct timerlat_aa_context *taa_ctx) if (!taa_ctx->taa_data) return; - for (i = 0; i < taa_ctx->nr_cpus; i++) { + for (i = 0; i < nr_cpus; i++) { taa_data = timerlat_aa_get_data(taa_ctx, i); if (taa_data->prev_irqs_seq) { @@ -842,7 +841,7 @@ static int timerlat_aa_init_seqs(struct timerlat_aa_context *taa_ctx) struct timerlat_aa_data *taa_data; int i; - for (i = 0; i < taa_ctx->nr_cpus; i++) { + for (i = 0; i < nr_cpus; i++) { taa_data = timerlat_aa_get_data(taa_ctx, i); @@ -1031,7 +1030,6 @@ int timerlat_aa_init(struct osnoise_tool *tool, int dump_tasks) __timerlat_aa_ctx = taa_ctx; - taa_ctx->nr_cpus = nr_cpus; taa_ctx->tool = tool; taa_ctx->dump_tasks = dump_tasks; diff --git a/tools/tracing/rtla/src/timerlat_hist.c b/tools/tracing/rtla/src/timerlat_hist.c index d4a9dcd67d48..207359f1cec4 100644 --- a/tools/tracing/rtla/src/timerlat_hist.c +++ b/tools/tracing/rtla/src/timerlat_hist.c @@ -44,7 +44,6 @@ struct timerlat_hist_data { struct timerlat_hist_cpu *hist; int entries; int bucket_size; - int nr_cpus; }; /* @@ -56,7 +55,7 @@ timerlat_free_histogram(struct timerlat_hist_data *data) int cpu; /* one histogram for IRQ and one for thread, per CPU */ - for (cpu = 0; cpu < data->nr_cpus; cpu++) { + for (cpu = 0; cpu < nr_cpus; cpu++) { if (data->hist[cpu].irq) free(data->hist[cpu].irq); @@ -94,7 +93,6 @@ static struct timerlat_hist_data data->entries = entries; data->bucket_size = bucket_size; - data->nr_cpus = nr_cpus; /* one set of histograms per CPU */ data->hist = calloc(1, sizeof(*data->hist) * nr_cpus); @@ -204,17 +202,17 @@ static int timerlat_hist_bpf_pull_data(struct osnoise_tool *tool) { struct timerlat_hist_data *data = tool->data; int i, j, err; - long long value_irq[data->nr_cpus], - value_thread[data->nr_cpus], - value_user[data->nr_cpus]; + long long value_irq[nr_cpus], + value_thread[nr_cpus], + value_user[nr_cpus]; /* Pull histogram */ for (i = 0; i < data->entries; i++) { err = timerlat_bpf_get_hist_value(i, value_irq, value_thread, - value_user, data->nr_cpus); + value_user, nr_cpus); if (err) return err; - for (j = 0; j < data->nr_cpus; j++) { + for (j = 0; j < nr_cpus; j++) { data->hist[j].irq[i] = value_irq[j]; data->hist[j].thread[i] = value_thread[j]; data->hist[j].user[i] = value_user[j]; @@ -226,7 +224,7 @@ static int timerlat_hist_bpf_pull_data(struct osnoise_tool *tool) value_irq, value_thread, value_user); if (err) return err; - for (i = 0; i < data->nr_cpus; i++) { + for (i = 0; i < nr_cpus; i++) { data->hist[i].irq_count = value_irq[i]; data->hist[i].thread_count = value_thread[i]; data->hist[i].user_count = value_user[i]; @@ -236,7 +234,7 @@ static int timerlat_hist_bpf_pull_data(struct osnoise_tool *tool) value_irq, value_thread, value_user); if (err) return err; - for (i = 0; i < data->nr_cpus; i++) { + for (i = 0; i < nr_cpus; i++) { data->hist[i].min_irq = value_irq[i]; data->hist[i].min_thread = value_thread[i]; data->hist[i].min_user = value_user[i]; @@ -246,7 +244,7 @@ static int timerlat_hist_bpf_pull_data(struct osnoise_tool *tool) value_irq, value_thread, value_user); if (err) return err; - for (i = 0; i < data->nr_cpus; i++) { + for (i = 0; i < nr_cpus; i++) { data->hist[i].max_irq = value_irq[i]; data->hist[i].max_thread = value_thread[i]; data->hist[i].max_user = value_user[i]; @@ -256,7 +254,7 @@ static int timerlat_hist_bpf_pull_data(struct osnoise_tool *tool) value_irq, value_thread, value_user); if (err) return err; - for (i = 0; i < data->nr_cpus; i++) { + for (i = 0; i < nr_cpus; i++) { data->hist[i].sum_irq = value_irq[i]; data->hist[i].sum_thread = value_thread[i]; data->hist[i].sum_user = value_user[i]; @@ -266,7 +264,7 @@ static int timerlat_hist_bpf_pull_data(struct osnoise_tool *tool) value_irq, value_thread, value_user); if (err) return err; - for (i = 0; i < data->nr_cpus; i++) { + for (i = 0; i < nr_cpus; i++) { data->hist[i].irq[data->entries] = value_irq[i]; data->hist[i].thread[data->entries] = value_thread[i]; data->hist[i].user[data->entries] = value_user[i]; @@ -300,7 +298,7 @@ static void timerlat_hist_header(struct osnoise_tool *tool) if (!params->common.hist.no_index) trace_seq_printf(s, "Index"); - for_each_monitored_cpu(cpu, data->nr_cpus, ¶ms->common) { + for_each_monitored_cpu(cpu, nr_cpus, ¶ms->common) { if (!data->hist[cpu].irq_count && !data->hist[cpu].thread_count) continue; @@ -352,7 +350,7 @@ timerlat_print_summary(struct timerlat_params *params, if (!params->common.hist.no_index) trace_seq_printf(trace->seq, "count:"); - for_each_monitored_cpu(cpu, data->nr_cpus, ¶ms->common) { + for_each_monitored_cpu(cpu, nr_cpus, ¶ms->common) { if (!data->hist[cpu].irq_count && !data->hist[cpu].thread_count) continue; @@ -374,7 +372,7 @@ timerlat_print_summary(struct timerlat_params *params, if (!params->common.hist.no_index) trace_seq_printf(trace->seq, "min: "); - for_each_monitored_cpu(cpu, data->nr_cpus, ¶ms->common) { + for_each_monitored_cpu(cpu, nr_cpus, ¶ms->common) { if (!data->hist[cpu].irq_count && !data->hist[cpu].thread_count) continue; @@ -402,7 +400,7 @@ timerlat_print_summary(struct timerlat_params *params, if (!params->common.hist.no_index) trace_seq_printf(trace->seq, "avg: "); - for_each_monitored_cpu(cpu, data->nr_cpus, ¶ms->common) { + for_each_monitored_cpu(cpu, nr_cpus, ¶ms->common) { if (!data->hist[cpu].irq_count && !data->hist[cpu].thread_count) continue; @@ -430,7 +428,7 @@ timerlat_print_summary(struct timerlat_params *params, if (!params->common.hist.no_index) trace_seq_printf(trace->seq, "max: "); - for_each_monitored_cpu(cpu, data->nr_cpus, ¶ms->common) { + for_each_monitored_cpu(cpu, nr_cpus, ¶ms->common) { if (!data->hist[cpu].irq_count && !data->hist[cpu].thread_count) continue; @@ -475,7 +473,7 @@ timerlat_print_stats_all(struct timerlat_params *params, sum.min_thread = ~0; sum.min_user = ~0; - for_each_monitored_cpu(cpu, data->nr_cpus, ¶ms->common) { + for_each_monitored_cpu(cpu, nr_cpus, ¶ms->common) { if (!data->hist[cpu].irq_count && !data->hist[cpu].thread_count) continue; @@ -622,7 +620,7 @@ timerlat_print_stats(struct osnoise_tool *tool) trace_seq_printf(trace->seq, "%-6d", bucket * data->bucket_size); - for_each_monitored_cpu(cpu, data->nr_cpus, ¶ms->common) { + for_each_monitored_cpu(cpu, nr_cpus, ¶ms->common) { if (!data->hist[cpu].irq_count && !data->hist[cpu].thread_count) continue; @@ -660,7 +658,7 @@ timerlat_print_stats(struct osnoise_tool *tool) if (!params->common.hist.no_index) trace_seq_printf(trace->seq, "over: "); - for_each_monitored_cpu(cpu, data->nr_cpus, ¶ms->common) { + for_each_monitored_cpu(cpu, nr_cpus, ¶ms->common) { if (!data->hist[cpu].irq_count && !data->hist[cpu].thread_count) continue; diff --git a/tools/tracing/rtla/src/timerlat_top.c b/tools/tracing/rtla/src/timerlat_top.c index 7b62549f69e3..34c8a0010828 100644 --- a/tools/tracing/rtla/src/timerlat_top.c +++ b/tools/tracing/rtla/src/timerlat_top.c @@ -42,7 +42,6 @@ struct timerlat_top_cpu { struct timerlat_top_data { struct timerlat_top_cpu *cpu_data; - int nr_cpus; }; /* @@ -72,8 +71,6 @@ static struct timerlat_top_data *timerlat_alloc_top(void) if (!data) return NULL; - data->nr_cpus = nr_cpus; - /* one set of histograms per CPU */ data->cpu_data = calloc(1, sizeof(*data->cpu_data) * nr_cpus); if (!data->cpu_data) @@ -191,16 +188,16 @@ static int timerlat_top_bpf_pull_data(struct osnoise_tool *tool) { struct timerlat_top_data *data = tool->data; int i, err; - long long value_irq[data->nr_cpus], - value_thread[data->nr_cpus], - value_user[data->nr_cpus]; + long long value_irq[nr_cpus], + value_thread[nr_cpus], + value_user[nr_cpus]; /* Pull summary */ err = timerlat_bpf_get_summary_value(SUMMARY_CURRENT, value_irq, value_thread, value_user); if (err) return err; - for (i = 0; i < data->nr_cpus; i++) { + for (i = 0; i < nr_cpus; i++) { data->cpu_data[i].cur_irq = value_irq[i]; data->cpu_data[i].cur_thread = value_thread[i]; data->cpu_data[i].cur_user = value_user[i]; @@ -210,7 +207,7 @@ static int timerlat_top_bpf_pull_data(struct osnoise_tool *tool) value_irq, value_thread, value_user); if (err) return err; - for (i = 0; i < data->nr_cpus; i++) { + for (i = 0; i < nr_cpus; i++) { data->cpu_data[i].irq_count = value_irq[i]; data->cpu_data[i].thread_count = value_thread[i]; data->cpu_data[i].user_count = value_user[i]; @@ -220,7 +217,7 @@ static int timerlat_top_bpf_pull_data(struct osnoise_tool *tool) value_irq, value_thread, value_user); if (err) return err; - for (i = 0; i < data->nr_cpus; i++) { + for (i = 0; i < nr_cpus; i++) { data->cpu_data[i].min_irq = value_irq[i]; data->cpu_data[i].min_thread = value_thread[i]; data->cpu_data[i].min_user = value_user[i]; @@ -230,7 +227,7 @@ static int timerlat_top_bpf_pull_data(struct osnoise_tool *tool) value_irq, value_thread, value_user); if (err) return err; - for (i = 0; i < data->nr_cpus; i++) { + for (i = 0; i < nr_cpus; i++) { data->cpu_data[i].max_irq = value_irq[i]; data->cpu_data[i].max_thread = value_thread[i]; data->cpu_data[i].max_user = value_user[i]; @@ -240,7 +237,7 @@ static int timerlat_top_bpf_pull_data(struct osnoise_tool *tool) value_irq, value_thread, value_user); if (err) return err; - for (i = 0; i < data->nr_cpus; i++) { + for (i = 0; i < nr_cpus; i++) { data->cpu_data[i].sum_irq = value_irq[i]; data->cpu_data[i].sum_thread = value_thread[i]; data->cpu_data[i].sum_user = value_user[i]; -- 2.52.0