/* * This file is part of Deliantra, the Roguelike Realtime MMORPG. * * Copyright (©) 2008 Marc Alexander Lehmann / Robin Redeker / the Deliantra team * * Deliantra 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 . * * The authors can be reached via e-mail to */ // This file is only included with -DDEVEL, and is only part // of the distributon for completeness, it is not supposed to // be useful outside the developers machines. #ifndef DEVEL_H #define DEVEL_H // used for benchmarking (x86/amd64-specific) typedef unsigned int cstamp; static inline cstamp stamp (void) { cstamp tsc; asm volatile ("rdtsc":"=a" (tsc)::"edx"); return tsc; } static inline cstamp measure (cstamp t) { cstamp tsc; asm volatile ("rdtsc":"=a" (tsc)::"edx"); if (tsc > t) return tsc - t; else return t - tsc; } // cstamp s = stamp (); // s = measure (s); #endif