diff --git a/MakefileNoOTB b/MakefileNoOTB index 26a0ea9..d9c16f7 100644 --- a/MakefileNoOTB +++ b/MakefileNoOTB @@ -16,11 +16,15 @@ TST_PRG = TestArrayTreeBuilder TST_SRC = $(patsubst %, $(CPP_DIR)/%.cpp, $(TST_PRG)) TST_OUT = $(patsubst %, $(OUT_DIR)/%, $(TST_PRG)) +PRF_PRG = PerfArrayTreeBuilder +PRF_SRC = $(patsubst %, $(CPP_DIR)/%.cpp, $(PRF_PRG)) +PRF_OUT = $(patsubst %, $(OUT_DIR)/%, $(PRF_PRG)) + ## FLAGS ############################### DFLAGS = -O2 -DNDEBUG -DBOOST_DISABLE_ASSERTS -DNO_OTB -DINTEL_TBB_THREAD #DFLAGS = -g -DENABLE_LOG -DNO_OTB -DTHREAD_DISABLE -DENABLE_SMART_LOG IFLAGS = $(DFLAGS) -MMD -I$(HPP_DIR) -LFLAGS = -L$(LIB_DIR) -ltriskele -lstdc++ -lpthread -ltbb -lboost_system -lboost_chrono -lboost_thread -lboost_program_options -lboost_date_time -lboost_serialization -lboost_filesystem -lboost_unit_test_framework -lgdal +LFLAGS = -L$(LIB_DIR) -ltriskele -lstdc++ -lpthread -lboost_system -lboost_chrono -lboost_thread -lboost_program_options -lboost_date_time -lboost_serialization -lboost_filesystem -lboost_unit_test_framework -lgdal -ltbb CC = g++ ## RULES ############################### @@ -35,15 +39,16 @@ $(OUT_DIR)/%: $(CPP_DIR)/*/%.cpp $(CC) $(IFLAGS) $< -L$(LIB_DIR) $(LFLAGS) -cpp -o $@ ## ENTRIES ############################# -all: init libtriskele apGenerator test +all: init libtriskele apGenerator test pref testA: all $(TST_OUT) testB: all -# $(APG_OUT) data/nairobi-byte.tif data/result.tif -b 0 -w 4000 -h 4000 --min-tree -A data/areaThresholds.txt # --debug -# $(APG_OUT) data/10m.tif data/result.tif -b 0 --min-tree --max-tree --tos-tree -A data/areaThresholds.txt -S data/sdThresholds.txt -M data/moiThresholds.txt # --debug - $(APG_OUT) data/10m.tif data/result.tif --min-tree --max-tree --tos-tree -A data/areaThresholds.txt -S data/sdThresholds.txt -M data/moiThresholds.txt # --debug + $(APG_OUT) data/10m.tif data/result.tif --min-tree --max-tree --tos-tree --alpha-tree -A data/areaThresholds.txt -S data/sdThresholds.txt -M data/moiThresholds.txt # --debug + +perfA: all + $(PRF_OUT) MIN 8 20 1000000 init: mkdir -p $(OUT_DIR) $(OBJ_DIR) $(LIB_DIR) @@ -58,10 +63,12 @@ wipe: clean libtriskele: $(LIB_DIR)/libtriskele.a $(APG_OUT): $(APG_SRC) $(LIB_DIR)/libtriskele.a -apGenerator: $(APG_OUT) - $(TST_OUT): $(TST_SRC) $(LIB_DIR)/libtriskele.a -test: $(TST_OUT) +$(PRF_OUT): $(PRF_SRC) $(LIB_DIR)/libtriskele.a + +apGenerator: $(APG_OUT) +test: init $(TST_OUT) +pref: init $(PRF_OUT) ## DEPENDS ############################# diff --git a/include/ArrayTree/ArrayTreeBuilder.hpp b/include/ArrayTree/ArrayTreeBuilder.hpp index 7e31d2b..290f600 100644 --- a/include/ArrayTree/ArrayTreeBuilder.hpp +++ b/include/ArrayTree/ArrayTreeBuilder.hpp @@ -38,7 +38,7 @@ namespace otb { DimImg *newCompId; WeightT *compWeights; public: - inline ArrayTreeBuilder (Raster &raster, const GraphWalker &graphWalker, + inline ArrayTreeBuilder (const Raster &raster, const GraphWalker &graphWalker, const TreeType &treeType, const bool &countingSort = true); inline ~ArrayTreeBuilder (); diff --git a/include/ArrayTree/ArrayTreeBuilder.tpp b/include/ArrayTree/ArrayTreeBuilder.tpp index dacc8fc..b514837 100644 --- a/include/ArrayTree/ArrayTreeBuilder.tpp +++ b/include/ArrayTree/ArrayTreeBuilder.tpp @@ -6,7 +6,7 @@ using namespace boost::chrono; // ======================================== template inline -ArrayTreeBuilder::ArrayTreeBuilder (Raster &raster, const GraphWalker &graphWalker, +ArrayTreeBuilder::ArrayTreeBuilder (const Raster &raster, const GraphWalker &graphWalker, const TreeType &treeType, const bool &countingSort) : coreCount (boost::thread::hardware_concurrency ()), raster (raster), diff --git a/include/TreeStats.hpp b/include/TreeStats.hpp index 4347b10..d981ad2 100644 --- a/include/TreeStats.hpp +++ b/include/TreeStats.hpp @@ -47,9 +47,10 @@ namespace otb { class TreeStats { public : - //void reset (); + void reset (); inline void addDim (const TreeType &treeType, const DimImg& leafCount, const DimImg& compCount); inline void addTime (const TimeType &timeType, const double &duration); + inline const TreeStatsDouble &getTimeStats (const TimeType &timeType); // nice ostream struct CPrintDim { @@ -68,6 +69,7 @@ namespace otb { }; CPrintTime printTime () const; friend ostream &operator << (ostream& out, const CPrintTime &cpt) { return cpt.print (out); } + private : TreeStatsDim leavesStats[TreeTypeCard], compStats[TreeTypeCard]; diff --git a/include/TreeStats.tpp b/include/TreeStats.tpp index dbd7ac5..b57edae 100644 --- a/include/TreeStats.tpp +++ b/include/TreeStats.tpp @@ -13,6 +13,11 @@ TreeStats::addTime (const TimeType &timeType, const double &duration) { timeStats[timeType] (duration); } +inline const TreeStatsDouble & +TreeStats::getTimeStats (const TimeType &timeType) { + return timeStats [timeType]; +} + // ======================================== diff --git a/src/TreeStats.cpp b/src/TreeStats.cpp index c9d1ef7..24aeda8 100644 --- a/src/TreeStats.cpp +++ b/src/TreeStats.cpp @@ -24,6 +24,17 @@ static string timeTypeLabels [TimeTypeCard] = { TreeStats globalTreeStats; +// ======================================== +void +TreeStats::reset () { + for (unsigned int i = 0; i < TreeTypeCard; ++i) { + leavesStats[i] = TreeStatsDim (); + compStats[i] = TreeStatsDim (); + } + for (unsigned int i = 0; i < TimeTypeCard; ++i) + timeStats[i] = TreeStatsDouble (); +} + // ======================================== using namespace boost::chrono; inline string