diff --git a/CrossBench/CrossBench.mk b/CrossBench/CrossBench.mk index e94e7ab..c318ee9 100644 --- a/CrossBench/CrossBench.mk +++ b/CrossBench/CrossBench.mk @@ -2,18 +2,18 @@ ## Auto Generated makefile by CodeLite IDE ## any manual changes will be erased ## -## Debug +## Release ProjectName :=CrossBench -ConfigurationName :=Debug +ConfigurationName :=Release WorkspacePath := "/data/Sync/SyncProjects/CrossGen" ProjectPath := "/data/Sync/SyncProjects/CrossGen/CrossBench" -IntermediateDirectory :=./Debug +IntermediateDirectory :=./Release OutDir := $(IntermediateDirectory) CurrentFileName := CurrentFilePath := CurrentFileFullPath := User :=Aleksey Lobanov -Date :=12/06/15 +Date :=13/06/15 CodeLitePath :="/home/alex/.codelite" LinkerName :=/usr/bin/g++-4.8 SharedObjectLinkerName :=/usr/bin/g++-4.8 -shared -fPIC @@ -28,14 +28,14 @@ LibraryPathSwitch :=-L PreprocessorSwitch :=-D SourceSwitch :=-c OutputFile :=$(IntermediateDirectory)/$(ProjectName) -Preprocessors := +Preprocessors :=$(PreprocessorSwitch)NDEBUG ObjectSwitch :=-o ArchiveOutputSwitch := PreprocessOnlySwitch :=-E ObjectsFileList :="CrossBench.txt" PCHCompileFlags := MakeDirCommand :=mkdir -p -LinkOptions := $(shell wx-config --debug=yes --libs --unicode=yes) +LinkOptions := -s $(shell wx-config --debug=no --libs --unicode=yes) IncludePath := $(IncludeSwitch). $(IncludeSwitch)../src IncludePCH := RcIncludePath := @@ -50,8 +50,8 @@ LibPath := $(LibraryPathSwitch). AR := /usr/bin/ar rcu CXX := /usr/bin/g++-4.8 CC := /usr/bin/gcc-4.8 -CXXFLAGS := -std=c++11 -g -O0 -Wall $(shell wx-config --cxxflags --unicode=yes --debug=yes) $(Preprocessors) -CFLAGS := -g -O0 -Wall $(shell wx-config --cxxflags --unicode=yes --debug=yes) $(Preprocessors) +CXXFLAGS := -std=c++11 -O2 -Wall $(shell wx-config --cxxflags --unicode=yes --debug=no) $(Preprocessors) +CFLAGS := -O2 -Wall $(shell wx-config --cxxflags --unicode=yes --debug=no) $(Preprocessors) ASFLAGS := AS := /usr/bin/as @@ -79,7 +79,7 @@ $(OutputFile): $(IntermediateDirectory)/.d $(Objects) $(LinkerName) $(OutputSwitch)$(OutputFile) @$(ObjectsFileList) $(LibPath) $(Libs) $(LinkOptions) $(IntermediateDirectory)/.d: - @test -d ./Debug || $(MakeDirCommand) ./Debug + @test -d ./Release || $(MakeDirCommand) ./Release PreBuild: @@ -101,6 +101,6 @@ $(IntermediateDirectory)/main.cpp$(PreprocessSuffix): main.cpp ## Clean ## clean: - $(RM) -r ./Debug/ + $(RM) -r ./Release/ diff --git a/CrossBench/CrossBench.txt b/CrossBench/CrossBench.txt index 6716386..65da2a2 100644 --- a/CrossBench/CrossBench.txt +++ b/CrossBench/CrossBench.txt @@ -1 +1 @@ -./Debug/main.cpp.o +./Release/main.cpp.o diff --git a/CrossBench/main.cpp b/CrossBench/main.cpp index ae5ec1f..60ee57a 100644 --- a/CrossBench/main.cpp +++ b/CrossBench/main.cpp @@ -20,6 +20,8 @@ static const wxCmdLineEntryDesc cmdLineDesc[] = { wxCMD_LINE_VAL_STRING }, { wxCMD_LINE_OPTION, wxT("c"), wxT("count"), wxT("times to run generation, default = 10") , wxCMD_LINE_VAL_NUMBER }, + { wxCMD_LINE_SWITCH, wxT("r"), wxT("rand"), wxT("enables generating random crosswords") , + wxCMD_LINE_VAL_NONE }, { wxCMD_LINE_SWITCH, wxT("h"), wxT("help"), wxT("show this help message"), wxCMD_LINE_VAL_NONE, wxCMD_LINE_OPTION_HELP }, { wxCMD_LINE_NONE } @@ -32,13 +34,17 @@ int main(int argc, char **argv) { return -1; } wxCmdLineParser cmd_parser(cmdLineDesc, argc, argv); + long run_count = 10; wxString grid_path, dict_path; + bool is_rand = false; + switch ( cmd_parser.Parse() ) { case -1: return 0; case 0: cmd_parser.Found(wxT("count"), &run_count); + is_rand = cmd_parser.Found(wxT("rand")); grid_path = cmd_parser.GetParam(0); dict_path = cmd_parser.GetParam(1); wxLogDebug(wxT("grid_path = ") + grid_path + wxT("\n")); @@ -55,8 +61,13 @@ int main(int argc, char **argv) { readDict(dict_path, dict); readGrid(grid_path, grid); - + + if ( is_rand ) + srand(time(NULL)); + for (long i = 0; i < run_count; ++i) { + if ( !is_rand ) + srand(42); words_out.clear(); durs.at(i) = wxGetLocalTimeMillis(); generateCross(grid,dict,words_out); @@ -65,7 +76,7 @@ int main(int argc, char **argv) { durs.at(i) = wxGetLocalTimeMillis() - durs.at(i); } wxLongLong tm_total = std::accumulate(durs.begin(),durs.end(), wxLongLong(0,0)); - wxLongLong tm_mean = tm_total / run_count; + wxLongLong tm_mean = (tm_total + run_count/2) / run_count; wxPrintf(wxT("Total time = ") + tm_total.ToString() + wxT(" ms.\nMean time = ") + tm_mean.ToString() + wxT(" ms.\n")); return 0; diff --git a/CrossGen.workspace b/CrossGen.workspace index 7998249..18ecac8 100644 --- a/CrossGen.workspace +++ b/CrossGen.workspace @@ -1,7 +1,7 @@ - - + + diff --git a/Makefile b/Makefile index c1fa320..68fba5b 100644 --- a/Makefile +++ b/Makefile @@ -1,8 +1,8 @@ .PHONY: clean All All: - @echo "----------Building project:[ wxCrossGen - Release ]----------" - @cd "wxCrossGen" && $(MAKE) -f "wxCrossGen.mk" + @echo "----------Building project:[ CrossBench - Release ]----------" + @cd "CrossBench" && $(MAKE) -f "CrossBench.mk" clean: - @echo "----------Cleaning project:[ wxCrossGen - Release ]----------" - @cd "wxCrossGen" && $(MAKE) -f "wxCrossGen.mk" clean + @echo "----------Cleaning project:[ CrossBench - Release ]----------" + @cd "CrossBench" && $(MAKE) -f "CrossBench.mk" clean diff --git a/wxCrossGen/wxCrossGen.mk b/wxCrossGen/wxCrossGen.mk index 88353a4..351fb57 100644 --- a/wxCrossGen/wxCrossGen.mk +++ b/wxCrossGen/wxCrossGen.mk @@ -2,12 +2,12 @@ ## Auto Generated makefile by CodeLite IDE ## any manual changes will be erased ## -## Release +## Debug ProjectName :=wxCrossGen -ConfigurationName :=Release +ConfigurationName :=Debug WorkspacePath := "/data/Sync/SyncProjects/CrossGen" ProjectPath := "/data/Sync/SyncProjects/CrossGen/wxCrossGen" -IntermediateDirectory :=../Release +IntermediateDirectory :=./Debug OutDir := $(IntermediateDirectory) CurrentFileName := CurrentFilePath := @@ -28,14 +28,14 @@ LibraryPathSwitch :=-L PreprocessorSwitch :=-D SourceSwitch :=-c OutputFile :=$(IntermediateDirectory)/$(ProjectName).out -Preprocessors :=$(PreprocessorSwitch)NDEBUG +Preprocessors := ObjectSwitch :=-o ArchiveOutputSwitch := PreprocessOnlySwitch :=-E ObjectsFileList :="wxCrossGen.txt" PCHCompileFlags := MakeDirCommand :=mkdir -p -LinkOptions := -s $(shell wx-config --debug=no --libs --unicode=yes) +LinkOptions := $(shell wx-config --debug=yes --libs --unicode=yes) IncludePath := $(IncludeSwitch). $(IncludeSwitch)../src IncludePCH := RcIncludePath := @@ -50,8 +50,8 @@ LibPath := $(LibraryPathSwitch). AR := /usr/bin/ar rcu CXX := /usr/bin/g++-4.8 CC := /usr/bin/gcc-4.8 -CXXFLAGS := -std=c++11 -O2 -Wall $(shell wx-config --cxxflags --unicode=yes --debug=no) $(Preprocessors) -CFLAGS := -O2 -Wall $(shell wx-config --cxxflags --unicode=yes --debug=no) $(Preprocessors) +CXXFLAGS := -std=c++11 -g -O0 -Wall $(shell wx-config --cxxflags --unicode=yes --debug=yes) $(Preprocessors) +CFLAGS := -g -O0 -Wall $(shell wx-config --cxxflags --unicode=yes --debug=yes) $(Preprocessors) ASFLAGS := AS := /usr/bin/as @@ -79,7 +79,7 @@ $(OutputFile): $(IntermediateDirectory)/.d $(Objects) $(LinkerName) $(OutputSwitch)$(OutputFile) @$(ObjectsFileList) $(LibPath) $(Libs) $(LinkOptions) $(IntermediateDirectory)/.d: - @test -d ../Release || $(MakeDirCommand) ../Release + @test -d ./Debug || $(MakeDirCommand) ./Debug PreBuild: @@ -101,6 +101,6 @@ $(IntermediateDirectory)/main.cpp$(PreprocessSuffix): main.cpp ## Clean ## clean: - $(RM) -r ../Release/ + $(RM) -r ./Debug/