Fix platform dependent printf format (#10120)
Adrien Mahieux committed
Oct 22, 2020 at 12:12 UTC
c4923783ed130c923e780d08ea8c507311a76aad
2 files changed
+10
-10
collectors/perf.plugin/perf_plugin.c
+1
-1
@@ -422,7 +422,7 @@ static int perf_collect() {
422
}
423
}
424
425
- if(unlikely(debug)) fprintf(stderr, "perf.plugin: successfully read event id = %u, value = %lu\n", current_event->id, current_event->value);
425
+ if(unlikely(debug)) fprintf(stderr, "perf.plugin: successfully read event id = %u, value = %"PRIu64"\n", current_event->id, current_event->value);
426
}
427
428
if(unlikely(perf_events[EV_ID_CPU_CYCLES].value == prev_cpu_cycles_value))
collectors/slabinfo.plugin/slabinfo.c
+9
-9
@@ -163,12 +163,12 @@ struct slabinfo *read_file_slabinfo() {
163
slabdebug("-> Reading procfile %s", PLUGIN_SLABINFO_PROCFILE);
164
165
static procfile *ff = NULL;
166
- static long slab_pagesize = 0;
166
+ static long slab_pagesize = 0;
167
168
- if (unlikely(!slab_pagesize)) {
169
- slab_pagesize = sysconf(_SC_PAGESIZE);
170
- slabdebug(" Discovered pagesize: %ld", slab_pagesize);
171
- }
168
+ if (unlikely(!slab_pagesize)) {
169
+ slab_pagesize = sysconf(_SC_PAGESIZE);
170
+ slabdebug(" Discovered pagesize: %ld", slab_pagesize);
171
+ }
172
173
if(unlikely(!ff)) {
174
ff = procfile_reopen(ff, PLUGIN_SLABINFO_PROCFILE, " ,:" , PROCFILE_FLAG_DEFAULT);
@@ -191,7 +191,7 @@ struct slabinfo *read_file_slabinfo() {
191
slabdebug(" Read %lu lines from procfile", (unsigned long)lines);
192
for(l = 2; l < lines; l++) {
193
if (unlikely(procfile_linewords(ff, l) < 14)) {
194
- slabdebug(" Line %lu has only %lu words, skipping", (unsigned long)l, procfile_linewords(ff,l));
194
+ slabdebug(" Line %zu has only %zu words, skipping", l, procfile_linewords(ff,l));
195
continue;
196
}
197
@@ -231,7 +231,7 @@ struct slabinfo *read_file_slabinfo() {
231
else
232
s->obj_filling = 0;
233
234
- slabdebug(" Updated slab %s: %lu %lu %lu %lu %lu / %lu %lu %lu / %lu %lu %lu / %lu %lu %hhu",
234
+ slabdebug(" Updated slab %s: %"PRIu64" %"PRIu64" %"PRIu64" %"PRIu64" %"PRIu64" / %"PRIu64" %"PRIu64" %"PRIu64" / %"PRIu64" %"PRIu64" %"PRIu64" / %"PRIu64" %"PRIu64" %hhu",
235
name, s->active_objs, s->num_objs, s->obj_size, s->obj_per_slab, s->pages_per_slab,
236
s->tune_limit, s->tune_batchcnt, s->tune_shared_factor,
237
s->data_active_slabs, s->data_num_slabs, s->data_shared_avail,
@@ -304,7 +304,7 @@ unsigned int do_slab_stats(int update_every) {
304
, "slabmemory"
305
);
306
for (s = sactive; s; s = s->next) {
307
- printf("SET %s = %lu\n"
307
+ printf("SET %s = %"PRIu64"\n"
308
, s->name
309
, s->mem_usage
310
);
@@ -334,7 +334,7 @@ unsigned int do_slab_stats(int update_every) {
334
, "slabwaste"
335
);
336
for (s = sactive; s; s = s->next) {
337
- printf("SET %s = %lu\n"
337
+ printf("SET %s = %"PRIu64"\n"
338
, s->name
339
, s->mem_waste
340
);