mirror of
https://github.com/torvalds/linux.git
synced 2026-05-29 17:43:52 +02:00
tools/rtla: Remove unneeded nr_cpus members
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 <costa.shul@redhat.com> Link: https://lore.kernel.org/r/20260306194953.2511960-4-costa.shul@redhat.com Signed-off-by: Tomas Glozar <tglozar@redhat.com>
This commit is contained in:
parent
ea06305ff9
commit
caf3fc0fdd
|
|
@ -29,7 +29,6 @@ struct osnoise_hist_data {
|
|||
struct osnoise_hist_cpu *hist;
|
||||
int entries;
|
||||
int bucket_size;
|
||||
int nr_cpus;
|
||||
};
|
||||
|
||||
/*
|
||||
|
|
@ -41,7 +40,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);
|
||||
}
|
||||
|
|
@ -73,7 +72,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)
|
||||
|
|
@ -246,7 +244,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;
|
||||
|
|
@ -275,7 +273,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;
|
||||
|
|
@ -287,7 +285,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;
|
||||
|
|
@ -300,7 +298,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;
|
||||
|
|
@ -316,7 +314,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;
|
||||
|
|
@ -351,7 +349,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;
|
||||
|
|
@ -387,7 +385,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;
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
enum stack_format stack_format;
|
||||
|
||||
|
|
@ -759,7 +758,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) {
|
||||
|
|
@ -787,7 +786,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;
|
||||
|
||||
|
|
@ -813,7 +812,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) {
|
||||
|
|
@ -863,7 +862,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);
|
||||
|
||||
|
|
@ -1052,7 +1051,6 @@ int timerlat_aa_init(struct osnoise_tool *tool, int dump_tasks, enum stack_forma
|
|||
|
||||
__timerlat_aa_ctx = taa_ctx;
|
||||
|
||||
taa_ctx->nr_cpus = nr_cpus;
|
||||
taa_ctx->tool = tool;
|
||||
taa_ctx->dump_tasks = dump_tasks;
|
||||
taa_ctx->stack_format = stack_format;
|
||||
|
|
|
|||
|
|
@ -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,9 +202,9 @@ 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++) {
|
||||
|
|
@ -214,7 +212,7 @@ static int timerlat_hist_bpf_pull_data(struct osnoise_tool *tool)
|
|||
value_user);
|
||||
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;
|
||||
|
|
|
|||
|
|
@ -41,7 +41,6 @@ struct timerlat_top_cpu {
|
|||
|
||||
struct timerlat_top_data {
|
||||
struct timerlat_top_cpu *cpu_data;
|
||||
int nr_cpus;
|
||||
};
|
||||
|
||||
/*
|
||||
|
|
@ -71,8 +70,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)
|
||||
|
|
@ -190,16 +187,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];
|
||||
|
|
@ -209,7 +206,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];
|
||||
|
|
@ -219,7 +216,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];
|
||||
|
|
@ -229,7 +226,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];
|
||||
|
|
@ -239,7 +236,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];
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user