/* * Copyright (C) 2011 Andrea Mazzoleni * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ #include "portable.h" #include "snapraid.h" #include "util.h" #include "raid.h" #include "cpu.h" void speed(void) { struct timeval start; struct timeval stop; int64_t ds; int64_t dt; unsigned i, j; unsigned char digest[HASH_SIZE]; unsigned count = 5000; unsigned block_size = 256 * 1024; unsigned diskmax = 4; void* buffer_alloc; unsigned char* buffer_aligned; unsigned char** buffer; buffer_aligned = malloc_nofail_align((diskmax + 2) * block_size, &buffer_alloc); buffer = malloc_nofail((diskmax + 2) * sizeof(void*)); for(i=0;i