From 7e3c69c82fbe3ac7de74b529f22582a2041a2f30 Mon Sep 17 00:00:00 2001 From: Alexey Spizhevoy Date: Tue, 25 Jan 2011 10:37:48 +0000 Subject: [PATCH] added GPU memory allocation performance test --- samples/gpu/performance/tests.cpp | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/samples/gpu/performance/tests.cpp b/samples/gpu/performance/tests.cpp index f7753c587..f9de6d880 100644 --- a/samples/gpu/performance/tests.cpp +++ b/samples/gpu/performance/tests.cpp @@ -131,4 +131,25 @@ TEST(cornerHarris) gpu::cornerHarris(d_src, d_dst, 5, 7, 0.1); GPU_OFF; } -} \ No newline at end of file +} + + +TEST(memoryAllocation) +{ + Mat mat; + gpu::GpuMat d_mat; + + int begin = 100, end = 8000, step = 100; + + DESCRIPTION << "32F matrices from " << begin << " to " << end; + + CPU_ON; + for (int size = begin; size <= end; size += step) + mat.create(size, size, CV_32FC1); + CPU_OFF; + + GPU_ON; + for (int size = begin; size <= end; size += step) + d_mat.create(size, size, CV_32FC1); + GPU_OFF; +}