From 91b7ba683e87524e6c969c9b751aaba64da3b504 Mon Sep 17 00:00:00 2001 From: vng Date: Sun, 9 Jan 2011 16:14:12 +0200 Subject: [PATCH] Better statistics; includes geometry size. --- indexer/indexer_tool/indexer_tool.cpp | 2 ++ indexer/indexer_tool/statistics.cpp | 37 ++++++++++++++++++++++----- indexer/indexer_tool/statistics.hpp | 4 ++- 3 files changed, 35 insertions(+), 8 deletions(-) diff --git a/indexer/indexer_tool/indexer_tool.cpp b/indexer/indexer_tool/indexer_tool.cpp index 7d548ac77b..d0646f7789 100644 --- a/indexer/indexer_tool/indexer_tool.cpp +++ b/indexer/indexer_tool/indexer_tool.cpp @@ -169,6 +169,8 @@ int main(int argc, char ** argv) { LOG(LINFO, ("Calculating statistics for ", datFile)); + stats::FileContainerStatistic(datFile); + stats::MapInfo info; stats::CalcStatistic(datFile, info); stats::PrintStatistic(info); diff --git a/indexer/indexer_tool/statistics.cpp b/indexer/indexer_tool/statistics.cpp index 79166d67b4..86b9b7cdc1 100644 --- a/indexer/indexer_tool/statistics.cpp +++ b/indexer/indexer_tool/statistics.cpp @@ -4,6 +4,7 @@ #include "../feature_processor.hpp" #include "../classificator.hpp" +#include "../feature_impl.hpp" #include "../../base/string_utils.hpp" @@ -14,6 +15,23 @@ namespace stats { + void FileContainerStatistic(string const & fName) + { + FilesContainerR cont(fName); + + vector tags; + tags.push_back(DATA_FILE_TAG); + for (int i = 0; i < ARRAY_SIZE(feature::g_arrScales); ++i) + { + tags.push_back(feature::GetTagForIndex(GEOMETRY_FILE_TAG, i)); + tags.push_back(feature::GetTagForIndex(TRIANGLE_FILE_TAG, i)); + } + tags.push_back(INDEX_FILE_TAG); + + for (size_t i = 0; i < tags.size(); ++i) + cout << tags[i] << " : " << cont.GetReader(tags[i]).Size() << endl; + } + class AccumulateStatistic { MapInfo & m_info; @@ -38,18 +56,22 @@ namespace stats { f.ParseBeforeStatistic(); - uint32_t const sz = f.GetAllSize(); - m_info.m_all.Add(sz); + uint32_t const datSize = f.GetAllSize(); + m_info.m_all.Add(datSize); m_info.m_names.Add(f.GetNameSize()); m_info.m_types.Add(f.GetTypesSize()); - int const level = 17; + FeatureType::geom_stat_t geom = f.GetGeometrySize(-1); + FeatureType::geom_stat_t trg = f.GetTrianglesSize(-1); - FeatureType::geom_stat_t geom = f.GetGeometrySize(level); m_info.AddToSet(geom.m_count, geom.m_size, m_info.m_byPointsCount); - m_info.AddToSet(f.GetFeatureType(), sz, m_info.m_byGeomType); + m_info.AddToSet(trg.m_count / 3, trg.m_size, m_info.m_byTrgCount); - ProcessType doProcess(m_info, sz); + uint32_t const allSize = datSize + geom.m_size + trg.m_size; + + m_info.AddToSet(f.GetFeatureType(), allSize, m_info.m_byGeomType); + + ProcessType doProcess(m_info, allSize); f.ForEachTypeRef(doProcess); } }; @@ -122,12 +144,13 @@ namespace stats void PrintStatistic(MapInfo & info) { - PrintInfo("ALL", info.m_all); + PrintInfo("DAT", info.m_all); PrintInfo("NAMES", info.m_names); PrintInfo("TYPES", info.m_types); PrintTop("Top SIZE by Geometry Type", info.m_byGeomType); PrintTop("Top SIZE by Classificator Type", info.m_byClassifType); PrintTop("Top SIZE by Points Count", info.m_byPointsCount); + PrintTop("Top SIZE by Triangles Count", info.m_byTrgCount); } } diff --git a/indexer/indexer_tool/statistics.hpp b/indexer/indexer_tool/statistics.hpp index 73e6b40590..cf1116c890 100644 --- a/indexer/indexer_tool/statistics.hpp +++ b/indexer/indexer_tool/statistics.hpp @@ -53,7 +53,7 @@ namespace stats { set > m_byGeomType; set > m_byClassifType; - set > m_byPointsCount; + set > m_byPointsCount, m_byTrgCount; GeneralInfo m_all, m_names, m_types; @@ -66,6 +66,8 @@ namespace stats } }; + void FileContainerStatistic(string const & fName); + void CalcStatistic(string const & fName, MapInfo & info); void PrintStatistic(MapInfo & info); }