Commit 72e38b66 authored by Paal Kvamme's avatar Paal Kvamme
Browse files

Add simple timers to check the parallel compression code.

parent 94a95ff1
......@@ -96,6 +96,8 @@
#include "subtiling.h"
#include "logger.h"
#include "compression.h"
#include "environment.h"
#include "timer.h"
#include "../exception.h"
#include <algorithm>
......@@ -131,6 +133,14 @@ namespace InternalZGY {
using namespace InternalZGY::ArrayOps;
using namespace InternalZGY::Formatters;
namespace {
static bool timers_on()
{
static int enable = Environment::getNumericEnv("OPENZGY_TIMERS", 0);
return enable > 0;
}
}
struct IJK
{
std::int64_t i0;
......@@ -346,6 +356,8 @@ ZgyInternalBulk::ZgyInternalBulk(
, _written_sample_min(std::numeric_limits<double>::infinity())
, _written_sample_max(-std::numeric_limits<double>::infinity())
, _loggerfn(logger ? logger : LoggerBase::standardCallback(LoggerBase::getVerboseFromEnv("OPENZGY_VERBOSE"), "openzgy-bulk:", ""))
, _ptimer_st(new SummaryPrintingTimer("writeAligned[S]"))
, _ptimer_mt(new SummaryPrintingTimer("writeAligned[M]"))
{
}
......@@ -1535,6 +1547,8 @@ ZgyInternalBulk::_writeAlignedRegion(
std::int32_t lod,
const compressor_t& compressor)
{
SimpleTimer t1(*_ptimer_mt, timers_on());
const double defaultstorage = this->_metadata->ih().defaultstorage();
const std::int64_t lodfactor = static_cast<std::int64_t>(1) << lod;
const IInfoHeaderAccess& ih = this->_metadata->ih();
......@@ -1662,6 +1676,8 @@ ZgyInternalBulk::_writeAlignedRegion(
// but might as well follow the same rules. That function is
// very lightweight.
t1.stop();
SimpleTimer t2(*_ptimer_st, timers_on());
ErrorsWillCorruptFile watchdog(this);
for (const auto& it : const_queue)
if (it)
......
......@@ -43,6 +43,7 @@ struct IJK;
struct LutInfoEx;
struct WriteBrickArgPack;
struct WriteNowArgPack;
class SummaryPrintingTimer;
/**
* Read or write bulk data. The meta data needs to have been read
......@@ -76,6 +77,8 @@ private:
double _written_sample_min;
double _written_sample_max;
LoggerFn _loggerfn;
std::shared_ptr<SummaryPrintingTimer> _ptimer_st;
std::shared_ptr<SummaryPrintingTimer> _ptimer_mt;
public:
ZgyInternalBulk(
......
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