Better memory statistics.

This commit is contained in:
Matthias Koefferlein
2018-04-15 00:54:30 +02:00
parent d35c713c9c
commit e1922da3b2
39 changed files with 832 additions and 733 deletions
+2 -2
View File
@@ -175,9 +175,9 @@ AnnotationShapes::undo (db::Op *op)
}
void
AnnotationShapes::collect_mem_stat (db::MemStatistics &m) const
AnnotationShapes::mem_stat (db::MemStatistics *stat, db::MemStatistics::purpose_t purpose, int cat, bool no_self, void *parent) const
{
m_layer.collect_mem_stat (m);
m_layer.mem_stat (stat, purpose, cat, no_self, parent);
}
void
+10 -1
View File
@@ -347,7 +347,7 @@ public:
/**
* @brief Collect memory usage
*/
void collect_mem_stat (db::MemStatistics &m) const;
void mem_stat (db::MemStatistics *stat, db::MemStatistics::purpose_t purpose, int cat, bool no_self, void *parent) const;
private:
void invalidate_state ()
@@ -360,6 +360,15 @@ private:
layer_type m_layer;
};
/**
* @brief Collect memory usage
*/
inline void mem_stat (db::MemStatistics *stat, db::MemStatistics::purpose_t purpose, int cat, const AnnotationShapes &x, bool no_self = false, void *parent = 0)
{
x.mem_stat (stat, purpose, cat, no_self, parent);
}
}
#endif
+4 -4
View File
@@ -2883,8 +2883,8 @@ LayoutView::reload_layout (unsigned int cv_index)
// print the memory statistics now.
if (tl::verbosity () >= 31) {
db::MemStatistics m;
cv->layout ().collect_mem_stat (m);
db::MemStatisticsCollector m (false);
cv->layout ().mem_stat (&m, db::MemStatistics::LayoutInfo, 0);
m.print ();
}
@@ -3120,8 +3120,8 @@ LayoutView::load_layout (const std::string &filename, const db::LoadLayoutOption
// print the memory statistics now.
if (tl::verbosity () >= 31) {
db::MemStatistics m;
cv->layout ().collect_mem_stat (m);
db::MemStatisticsCollector m (false);
cv->layout ().mem_stat (&m, db::MemStatistics::LayoutInfo, 0);
m.print ();
}
@@ -81,8 +81,13 @@ public:
const Sh &shape () const { return m_shape; }
size_t mem_used () const { return 0; }
size_t mem_reqd () const { return 0; }
virtual void mem_stat (db::MemStatistics *stat, db::MemStatistics::purpose_t purpose, int cat, bool no_self, void *parent) const
{
if (! no_self) {
stat->add (typeid (*this), (void *) this, sizeof (*this), sizeof (*this), parent, purpose, cat);
}
db::mem_stat (stat, purpose, cat, m_shape, true, (void *) this);
}
private:
Sh m_shape;