MCPcopy Create free account
hub / github.com/RenderKit/embree / thread_alloc

Method thread_alloc

kernels/subdiv/tessellation_cache.cpp:260–294  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

258 }
259
260 static void thread_alloc(cache_regression_test* This)
261 {
262 int threadID = This->threadIDCounter++;
263 size_t maxN = SharedLazyTessellationCache::sharedLazyTessellationCache.maxAllocSize()/4;
264 This->barrier.wait();
265
266 for (size_t j=0; j<100000; j++)
267 {
268 size_t elt = (threadID+j)%numEntries;
269 size_t N = min(1+10*(elt%1000),maxN);
270
271 volatile int* data = (volatile int*) SharedLazyTessellationCache::lookup(This->entry[elt],0,[&] () {
272 int* data = (int*) SharedLazyTessellationCache::sharedLazyTessellationCache.malloc(4*N);
273 for (size_t k=0; k<N; k++) data[k] = (int)elt;
274 return data;
275 });
276
277 if (data == nullptr) {
278 SharedLazyTessellationCache::sharedLazyTessellationCache.unlock();
279 This->numFailed++;
280 continue;
281 }
282
283 /* check memory block */
284 for (size_t k=0; k<N; k++) {
285 if (data[k] != (int)elt) {
286 This->numFailed++;
287 break;
288 }
289 }
290
291 SharedLazyTessellationCache::sharedLazyTessellationCache.unlock();
292 }
293 This->barrier.wait();
294 }
295
296 bool run ()
297 {

Callers

nothing calls this directly

Calls 5

lookupFunction · 0.85
minFunction · 0.50
waitMethod · 0.45
mallocMethod · 0.45
unlockMethod · 0.45

Tested by

no test coverage detected