/* * 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" /** * Differential us of two timeval. */ static int64_t diffgettimeofday(struct timeval* start, struct timeval* stop) { return 1000000LL * (stop->tv_sec - start->tv_sec) + stop->tv_usec - start->tv_usec; } /** * Start time measurement. */ #define SPEED_START \ count = 0; \ gettimeofday(&start, 0); \ do { \ for(i=0;i