Commit 515d25bb authored by Paal Kvamme's avatar Paal Kvamme
Browse files

Add a higher level performance test.

parent ec72cb49
...@@ -2341,6 +2341,38 @@ test_readwrite_cloud() ...@@ -2341,6 +2341,38 @@ test_readwrite_cloud()
Test_Utils::CloudFileAutoDelete cad("readwrite_cloud.zgy", context); Test_Utils::CloudFileAutoDelete cad("readwrite_cloud.zgy", context);
do_test_readwrite(cad.name(), context); do_test_readwrite(cad.name(), context);
} }
static void
read_hammer(std::shared_ptr<IZgyReader> reader, int repeats)
{
const std::array<std::int64_t,3> start{0, 0, 0};
const std::array<std::int64_t,3> size{64, 64, 64};
std::shared_ptr<float> data(new float[size[0]*size[1]*size[2]]);
for (int ii = 0; ii < repeats; ++ii)
reader->read(start, size, data.get(), 0);
}
/**
* Hammer the same brick in the same file again and again and ...
* To use this for a real performance test you may need to increase
* the number of threads and repeats.
*/
static void
test_hammer()
{
using InternalZGY::Environment;
const int repeats = Environment::getNumericEnv("OPENZGY_HAMMER_REPEATS", 8);
const int threads = Environment::getNumericEnv("OPENZGY_HAMMER_THREADS", 8);
const std::string name= Environment::getStringEnv("OPENZGY_HAMMER_NAME",
cloud_synt2_name().c_str());
std::shared_ptr<IZgyReader> reader =
IZgyReader::open(name, Test_Utils::default_sd_context());
std::vector<std::thread> workers;
for (int ii = 0; ii < threads; ++ii)
workers.push_back(std::thread(read_hammer, reader, repeats));
for (int ii = 0; ii < threads; ++ii)
workers[ii].join();
}
#endif #endif
namespace { namespace {
...@@ -2753,6 +2785,7 @@ public: ...@@ -2753,6 +2785,7 @@ public:
register_test("api.readwrite", test_readwrite_local); register_test("api.readwrite", test_readwrite_local);
#ifdef HAVE_SD #ifdef HAVE_SD
register_test("api.readwrite_cloud", test_readwrite_cloud); register_test("api.readwrite_cloud", test_readwrite_cloud);
register_test("api.hammer", test_hammer);
#endif #endif
register_test("api.edgebricks", test_edgebricks); register_test("api.edgebricks", test_edgebricks);
register_test("api.bat_local_1", test_bat_local_1); register_test("api.bat_local_1", test_bat_local_1);
......
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