Commit 4cc80a53 authored by Paal Kvamme's avatar Paal Kvamme
Browse files

More ad-hoc performance measurement output.

parent 164518f4
......@@ -767,6 +767,7 @@ public:
bool force = false)
{
if (this->_dirty || force) {
InternalZGY::DataBuffer::cleartimers(true);
this->_dirty = false;
std::shared_ptr<InternalZGY::StatisticData> stats;
std::shared_ptr<InternalZGY::HistogramData> histo;
......
......@@ -77,6 +77,9 @@ namespace {
* If I need a report each time a DataBuffer goes out of scope
* it would be different.
*
* For slightly more advanced usage, a global cleartimers() can
* be called to output all collected details at that point.
*
* \details Thread safety: Safe because SummaryPrintingTimer is
* thread safe when used correctly.
*/
......@@ -108,6 +111,30 @@ namespace {
static AdHocTimers instance_;
return instance_;
}
void cleartimers(bool show) {
if (show) {
copysubset.print();
copyscalar.print();
scaletos.print();
scaletof.print();
clone.print();
range.print();
fill.print();
allsame.print();
ctor.print();
}
else {
copysubset.reset();
copyscalar.reset();
scaletos.reset();
scaletof.reset();
clone.reset();
range.reset();
fill.reset();
allsame.reset();
ctor.reset();
}
}
};
}
......@@ -1171,6 +1198,15 @@ DataBufferNd<T,NDim>::slice1(int dim, std::int64_t start, std::int64_t size) con
return slice(neworig, newsize);
}
/**
* For ad-hoc performance measurements.
*/
void
DataBuffer::cleartimers(bool show)
{
AdHocTimers::instance().cleartimers(show);
}
// Explicit template instanciation.
OPENZGY_IMPLEMENT_EXPLICIT_TEMPLATE(DataBufferNd<std::int8_t,3>)
OPENZGY_IMPLEMENT_EXPLICIT_TEMPLATE(DataBufferNd<std::uint8_t,3>)
......
......@@ -254,6 +254,7 @@ public:
virtual void check_cstride() const = 0;
virtual std::shared_ptr<DataBuffer> slice1(int dim, std::int64_t start, std::int64_t size) const = 0;
static std::shared_ptr<DataBuffer> makeDataBuffer3d(void *raw, std::int64_t nbytes, const std::array<std::int64_t,3>& size, RawDataType dtype);
static void cleartimers(bool show);
};
/**
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment