mirror of
https://github.com/tiagovignatti/intel-gpu-tools.git
synced 2026-08-24 14:45:46 +00:00
lib: extract drmtest_permute_array
Lots of tests need to create havoc to LRUs in the kernel or otherwise need to shuffle things around a bit. So make a small array permutation function available. Signed-Off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
This commit is contained in:
@@ -332,6 +332,22 @@ void drmtest_stop_signal_helper(void)
|
||||
signal_helper = -1;
|
||||
}
|
||||
|
||||
/* other helpers */
|
||||
void drmtest_permute_array(void *array, unsigned size,
|
||||
void (*exchange_func)(void *array,
|
||||
unsigned i,
|
||||
unsigned j))
|
||||
{
|
||||
int i;
|
||||
|
||||
for (i = size - 1; i > 1; i--) {
|
||||
/* yes, not perfectly uniform, who cares */
|
||||
long l = random() % (i +1);
|
||||
if (i != l)
|
||||
exchange_func(array, i, l);
|
||||
}
|
||||
}
|
||||
|
||||
/* mappable aperture trasher helper */
|
||||
drm_intel_bo **trash_bos;
|
||||
int num_trash_bos;
|
||||
|
||||
Reference in New Issue
Block a user