File: fix-mem_log-for-32-bit.patch

package info (click to toggle)
charliecloud 0.42-3
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 3,096 kB
  • sloc: python: 5,975; sh: 4,282; ansic: 3,820; makefile: 597
file content (57 lines) | stat: -rw-r--r-- 2,096 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
From: Jordan Ogas <jogas@lanl.gov>
Date: Wed, 29 Oct 2025 13:06:44 -0600
Subject: fix mem_log for 32-bit

Origin: upstream, https://gitlab.com/charliecloud/charliecloud/-/merge_requests/1989.diff
---
 bin/mem.c | 21 +++++++++++----------
 1 file changed, 11 insertions(+), 10 deletions(-)

diff --git a/bin/mem.c b/bin/mem.c
index 0da4b95..6ac058e 100644
--- a/bin/mem.c
+++ b/bin/mem.c
@@ -310,32 +310,33 @@ void mem_log(const char *when)
    syslog(SYSLOG_PRI, "%s", s);
 #endif
 
-   // log GC stuff
 #ifdef HAVE_GC
+   // log GC stuff
    GC_get_prof_stats(&ps, sizeof(ps));
-   time_collecting = GC_get_full_gc_total_time();
-   // space
+   time_collecting = GC_get_full_gc_total_time(); // ms
    used = ps.heapsize_full - ps.free_bytes_full;
    used_prev = heapsize_prev - free_prev;
+
    s = asprintf_ch("gc:  %s: "
          "%zdkB %+zd (used %zdkB %+zd, free %zdkB %+zd, unmp %zdkB %+zd)",
          when,
-         kB(ps.heapsize_full), kB(ps.heapsize_full - heapsize_prev),
-         kB(used), kB(used - used_prev),
+         kB(ps.heapsize_full),   kB(ps.heapsize_full - heapsize_prev),
+         kB(used),               kB(used - used_prev),
          kB(ps.free_bytes_full), kB(ps.free_bytes_full - free_prev),
-         kB(ps.unmapped_bytes), kB(ps.unmapped_bytes - unmapped_prev));
+         kB(ps.unmapped_bytes),  kB(ps.unmapped_bytes - unmapped_prev));
    heapsize_prev = ps.heapsize_full;
-   free_prev = ps.free_bytes_full;
+   free_prev     = ps.free_bytes_full;
    unmapped_prev = ps.unmapped_bytes;
    DEBUG("%s", s);
 #ifdef ENABLE_SYSLOG
    syslog(SYSLOG_PRI, "%s", s);
 #endif
-   // time
+
+   // GC time: **only** the format specifiers are changed to match 'long'
    s = asprintf_ch("gc:  "
-         "%s: %ld collections (%+ld) in %zdms (%+zd)",
+         "%s: %ld collections (%+ld) in %ldms (%+ld)",
          when,
-         ps.gc_no, ps.gc_no - gc_no_prev,
+         (long)ps.gc_no, (long)(ps.gc_no - gc_no_prev),
          time_collecting, time_collecting - time_collecting_prev);
    gc_no_prev = ps.gc_no;
    time_collecting_prev = time_collecting;