Commit 9d0b67e7 authored by Paal Kvamme's avatar Paal Kvamme
Browse files

Add logging close to the public read() and write() when OPENZGY_VERBOSE >=2....

Add logging close to the public read() and write() when OPENZGY_VERBOSE >=2. Lower level logging often see regions already broken into bricks.
parent 87c9d1a8
Pipeline #55476 passed with stages
in 11 minutes and 11 seconds
......@@ -616,6 +616,26 @@ ZgyInternalBulk::readConstantValue(
result = (result * this->_metadata->ih().storagetofloat_slope() +
this->_metadata->ih().storagetofloat_intercept());
}
// Only logging success, because on failure the application will
// need to read the actual data. Which will trigger the logging
// in readToExistingBuffer.
if (_logger(2))
_logger(2, std::stringstream()
<< "read(start="
<< "(" << start[0]
<< "," << start[1]
<< "," << start[2]
<< ")"
<< ", size="
<< "(" << size[0]
<< "," << size[1]
<< "," << size[2]
<< ")"
<< ", lod=" << lod
<< std::boolalpha << ", as_float=" << as_float << ")"
<< " => constant " << result);
return std::make_pair(true,result);
}
......@@ -646,6 +666,19 @@ ZgyInternalBulk::readToExistingBuffer(
if (result->datatype() != expected_dtype)
throw OpenZGY::Errors::ZgyUserError("Requested data type not supported for this file.");
if (_logger(2))
_logger(2, std::stringstream()
<< "read(start="
<< "(" << start[0]
<< "," << start[1]
<< "," << start[2]
<< "), size="
<< "(" << result->size3d()[0]
<< "," << result->size3d()[1]
<< "," << result->size3d()[2]
<< "), lod=" << lod
<< std::boolalpha << ", as_float=" << as_float << ")");
// Need a default value to use when trying to read a brick that
// was never written, or to fill in a brick that was only partly
// written. To avoid non intuitive behavior the same value should
......@@ -2351,6 +2384,19 @@ ZgyInternalBulk::writeRegion(
_metadata->ih().datatype()))
throw OpenZGY::Errors::ZgyUserError("Invalid data type in writeRegion");
if (_logger(2))
_logger(2, std::stringstream()
<< "write(start="
<< "(" << start[0]
<< "," << start[1]
<< "," << start[2]
<< "), size="
<< "(" << data->size3d()[0]
<< "," << data->size3d()[1]
<< "," << data->size3d()[2]
<< "), lod=" << lod
<< std::boolalpha << ", is_storage=" << is_storage << ")");
// TODO-Performance: Combining range() and _scaleDataToStorage()
// might save some time.
......
Markdown is supported
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