Print the amount of memory used for MT

This commit is contained in:
Andrea Mazzoleni 2016-01-05 13:58:08 +01:00
parent 4191989fa7
commit fb404ef149
2 changed files with 6 additions and 1 deletions

View file

@ -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;

View file

@ -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)));
}
/****************************************************************************/