[generator] Added number of objects with name to statistics.

This commit is contained in:
Maksim Andrianov 2019-03-19 16:28:59 +03:00 committed by mpimenov
parent 2069bcc589
commit 18942cf07c
2 changed files with 13 additions and 8 deletions

View file

@ -96,14 +96,16 @@ namespace stats
}, FeatureType::BEST_GEOMETRY);
}
m_info.m_byGeomType[f.GetGeomType()].Add(allSize, len, area);
bool hasName = f.GetNames().CountLangs() != 0;
f.ForEachType([this, allSize, len, area](uint32_t type)
m_info.m_byGeomType[f.GetGeomType()].Add(allSize, len, area, hasName);
f.ForEachType([this, allSize, len, area, hasName](uint32_t type)
{
m_info.m_byClassifType[ClassifType(type)].Add(allSize, len, area);
m_info.m_byClassifType[ClassifType(type)].Add(allSize, len, area, hasName);
});
m_info.m_byAreaSize[AreaType(GetAreaIndex(area))].Add(trg.m_size, len, area);
m_info.m_byAreaSize[AreaType(GetAreaIndex(area))].Add(trg.m_size, len, area, hasName);
}
};
@ -116,11 +118,12 @@ namespace stats
void PrintInfo(std::string const & prefix, GeneralInfo const & info, bool measurements)
{
std::cout << prefix << ": size = " << info.m_size << "; count = " << info.m_count;
if (measurements)
{
std::cout << "; length = " << uint64_t(info.m_length) << " m; area = " << uint64_t(info.m_area) << "";
}
std::cout << endl;
std::cout << "; names = " << info.m_names << endl;
}
std::string GetKey(GeomType type)

View file

@ -10,12 +10,12 @@ namespace stats
{
struct GeneralInfo
{
uint64_t m_count, m_size;
uint64_t m_count, m_size, m_names;
double m_length, m_area;
GeneralInfo() : m_count(0), m_size(0), m_length(0), m_area(0) {}
GeneralInfo() : m_count(0), m_size(0), m_names(0), m_length(0), m_area(0) {}
void Add(uint64_t szBytes, double len = 0, double area = 0)
void Add(uint64_t szBytes, double len = 0, double area = 0, bool hasName = false)
{
if (szBytes > 0)
{
@ -23,6 +23,8 @@ namespace stats
m_size += szBytes;
m_length += len;
m_area += area;
if (hasName)
++m_names;
}
}
};