diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 5c7b719..d08d3af 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -204,6 +204,7 @@ set(common_SRCS sha1.cpp base64.cpp ban.cpp + speedtests.cpp gettime.cpp main.cpp ) diff --git a/src/gettime.h b/src/gettime.h index cb86cfa..5798c03 100644 --- a/src/gettime.h +++ b/src/gettime.h @@ -1,6 +1,12 @@ /* +BlockPlanet +Copyright (C) 2012 MiJyn, Joel Leclerc +Licensed under GPLv3 + + +Based on: Minetest-c55 -Copyright (C) 2010 celeron55, Perttu Ahola +Copyright (C) 2010-2011 celeron55, Perttu Ahola 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 diff --git a/src/main.cpp b/src/main.cpp index 0a7e5c5..bb546d1 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -71,6 +71,7 @@ with this program; if not, write to the Free Software Foundation, Inc., #include "utility_string.h" #include "subgame.h" #include "quicktune.h" +#include "speedtests.h" /* Settings. @@ -598,104 +599,6 @@ void drawMenuBackground(video::IVideoDriver* driver) #endif -// These are defined global so that they're not optimized too much. -// Can't change them to volatile. -s16 temp16; -f32 tempf; -v3f tempv3f1; -v3f tempv3f2; -std::string tempstring; -std::string tempstring2; - -void SpeedTests() -{ - { - infostream<<"The following test should take around 20ms."< map1; - tempf = -324; - const s16 ii=300; - for(s16 y=0; y=0; y--){ - for(s16 x=0; x &worldspecs, std::ostream &os) { @@ -1256,7 +1159,9 @@ int main(int argc, char *argv[]) if(cmd_args.getFlag("speedtests")) { dstream<<"Running speed tests"<SpeedTests(); + delete(st); return 0; } diff --git a/src/speedtests.cpp b/src/speedtests.cpp new file mode 100644 index 0000000..4ea444b --- /dev/null +++ b/src/speedtests.cpp @@ -0,0 +1,118 @@ +/* +BlockPlanet +Copyright (C) 2012 MiJyn, Joel Leclerc +Licensed under GPLv3 + + +Based on: +Minetest-c55 +Copyright (C) 2010-2011 celeron55, Perttu Ahola + +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 2 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, write to the Free Software Foundation, Inc., +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. +*/ + +#include "speedtests.h" +#include "common_irrlicht.h" +#include "utility.h" +#include "log.h" + +void SpeedTest::SpeedTests() +{ + { + infostream<<"The following test should take around 20ms."< map1; + tempf = -324; + const s16 ii=300; + for(s16 y=0; y=0; y--){ + for(s16 x=0; x +Licensed under GPLv3 + + +Based on: +Minetest-c55 +Copyright (C) 2010-2011 celeron55, Perttu Ahola + +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 2 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, write to the Free Software Foundation, Inc., +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. +*/ + +#ifndef SPEEDTESTS_HEADER +#define SPEEDTESTS_HEADER + +#include +#include "common_irrlicht.h" + +class SpeedTest +{ + private: + // These are defined global so that they're not optimized too much. + // Can't change them to volatile. + s16 temp16; + f32 tempf; + v3f tempv3f1; + v3f tempv3f2; + std::string tempstring; + std::string tempstring2; + + public: + void SpeedTests(); +}; + +#endif