From 3fdbb950809216bada4db636cb7d723ed67e332c Mon Sep 17 00:00:00 2001 From: Rodrigo Arias Date: Fri, 21 Jun 2024 11:59:16 +0200 Subject: [PATCH] Fix remaining problems for 32 bits architectures --- src/emu/cpu.c | 4 ++-- src/emu/model_thread.c | 4 ++-- src/emu/nosv/breakdown.c | 8 ++++---- src/emu/pv/prv.c | 8 ++++---- 4 files changed, 12 insertions(+), 12 deletions(-) diff --git a/src/emu/cpu.c b/src/emu/cpu.c index 3c4fe66..666470e 100644 --- a/src/emu/cpu.c +++ b/src/emu/cpu.c @@ -1,4 +1,4 @@ -/* Copyright (c) 2021-2023 Barcelona Supercomputing Center (BSC) +/* Copyright (c) 2021-2024 Barcelona Supercomputing Center (BSC) * SPDX-License-Identifier: GPL-3.0-or-later */ #include "cpu.h" @@ -17,7 +17,7 @@ #include "utlist.h" #include "value.h" -static const char chan_fmt[] = "cpu%ld.%s"; +static const char chan_fmt[] = "cpu%"PRIi64".%s"; static const char *chan_name[CPU_CHAN_MAX] = { [CPU_CHAN_NRUN] = "nrunning", [CPU_CHAN_PID] = "pid_running", diff --git a/src/emu/model_thread.c b/src/emu/model_thread.c index ef7faaf..7266ae3 100644 --- a/src/emu/model_thread.c +++ b/src/emu/model_thread.c @@ -1,4 +1,4 @@ -/* Copyright (c) 2021-2023 Barcelona Supercomputing Center (BSC) +/* Copyright (c) 2021-2024 Barcelona Supercomputing Center (BSC) * SPDX-License-Identifier: GPL-3.0-or-later */ #include "model_thread.h" @@ -19,7 +19,7 @@ static int init_chan(struct model_thread *th, const struct model_chan_spec *spec, int64_t gindex) { - const char *fmt = "%s.thread%ld.%s"; + const char *fmt = "%s.thread%"PRIi64".%s"; const char *prefix = spec->prefix; th->ch = calloc(spec->nch, sizeof(struct chan)); diff --git a/src/emu/nosv/breakdown.c b/src/emu/nosv/breakdown.c index f3e6345..735552a 100644 --- a/src/emu/nosv/breakdown.c +++ b/src/emu/nosv/breakdown.c @@ -33,8 +33,8 @@ static int create_cpu(struct bay *bay, struct nosv_breakdown_cpu *bcpu, int64_t gindex) { enum chan_type t = CHAN_SINGLE; - chan_init(&bcpu->tr, t, "nosv.cpu%ld.breakdown.tr", gindex); - chan_init(&bcpu->tri, t, "nosv.cpu%ld.breakdown.tri", gindex); + chan_init(&bcpu->tr, t, "nosv.cpu%"PRIi64".breakdown.tr", gindex); + chan_init(&bcpu->tri, t, "nosv.cpu%"PRIi64".breakdown.tri", gindex); /* Register all channels in the bay */ if (bay_register(bay, &bcpu->tr) != 0) { @@ -161,7 +161,7 @@ select_tr(struct mux *mux, struct value value, struct mux_input **input) int64_t i = in_body; char *inputs[] = { "subsystem", "task_type" }; - dbg("selecting input %ld (%s)", i, inputs[i]); + dbg("selecting input %"PRIi64" (%s)", i, inputs[i]); *input = mux_get_input(mux, i); return 0; @@ -327,7 +327,7 @@ model_nosv_breakdown_finish(struct emu *emu, struct prf *prf = pvt_get_prf(bemu->pvt); for (int64_t row = 0; row < bemu->nphycpus; row++) { char name[128]; - if (snprintf(name, 128, "~CPU %4ld", bemu->nphycpus - row) >= 128) { + if (snprintf(name, 128, "~CPU %4"PRIi64, bemu->nphycpus - row) >= 128) { err("label too long"); return -1; } diff --git a/src/emu/pv/prv.c b/src/emu/pv/prv.c index d66dad1..c227f1e 100644 --- a/src/emu/pv/prv.c +++ b/src/emu/pv/prv.c @@ -1,4 +1,4 @@ -/* Copyright (c) 2021-2023 Barcelona Supercomputing Center (BSC) +/* Copyright (c) 2021-2024 Barcelona Supercomputing Center (BSC) * SPDX-License-Identifier: GPL-3.0-or-later */ #include "prv.h" @@ -69,9 +69,9 @@ find_prv_chan(struct prv *prv, long id) } static void -write_line(struct prv *prv, long row_base1, long type, long value) +write_line(struct prv *prv, long row_base1, int64_t type, int64_t value) { - fprintf(prv->file, "2:0:1:1:%ld:%" PRIi64 ":%ld:%ld\n", + fprintf(prv->file, "2:0:1:1:%ld:%"PRIi64":%"PRIi64":%"PRIi64"\n", row_base1, prv->time, type, value); } @@ -117,7 +117,7 @@ emit(struct prv *prv, struct prv_chan *rchan) } /* Assume null */ - long val = 0; + int64_t val = 0; if (likely(value.type == VALUE_INT64)) { val = value.i; if (rchan->flags & PRV_NEXT)