From fb404ef14959f81149960c6cfda994aac71c02f3 Mon Sep 17 00:00:00 2001 From: Andrea Mazzoleni Date: Tue, 5 Jan 2016 13:58:08 +0100 Subject: [PATCH] Print the amount of memory used for MT --- cmdline/io.c | 5 +++++ cmdline/snapraid.c | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/cmdline/io.c b/cmdline/io.c index f4c085ca..02627787 100644 --- a/cmdline/io.c +++ b/cmdline/io.c @@ -27,6 +27,7 @@ void io_init(struct snapraid_io* io, struct snapraid_state* state, unsigned buff struct snapraid_parity_handle* parity_handle_map, unsigned parity_handle_max) { unsigned i; + size_t allocated; pthread_mutex_init(&io->mutex, 0); pthread_cond_init(&io->read_done, 0); @@ -37,12 +38,16 @@ void io_init(struct snapraid_io* io, struct snapraid_state* state, unsigned buff io->state = state; io->buffer_max = buffer_max; + allocated = 0; for (i = 0; i < IO_MAX; ++i) { io->buffer_map[i] = malloc_nofail_vector_align(handle_max, buffer_max, state->block_size, &io->buffer_alloc_map[i]); if (!state->opt.skip_self) mtest_vector(io->buffer_max, state->block_size, io->buffer_map[i]); + allocated += state->block_size * buffer_max; } + msg_progress("Using %u MiB of memory for the MT buffers.\n", (unsigned)(allocated / (1024 * 1024))); + if (parity_writer) { io->reader_max = handle_max; io->writer_max = parity_handle_max; diff --git a/cmdline/snapraid.c b/cmdline/snapraid.c index 438c10d8..22674292 100644 --- a/cmdline/snapraid.c +++ b/cmdline/snapraid.c @@ -85,7 +85,7 @@ void memory(void) log_tag("memory:link:%" PRIu64 "\n", (uint64_t)(sizeof(struct snapraid_link))); log_tag("memory:dir:%" PRIu64 "\n", (uint64_t)(sizeof(struct snapraid_dir))); - msg_progress("Using %u MiB of memory.\n", (unsigned)(malloc_counter_get() / (1024 * 1024))); + msg_progress("Using %u MiB of memory for the FileSystem.\n", (unsigned)(malloc_counter_get() / (1024 * 1024))); } /****************************************************************************/