test_clear.c File Reference
Unit test for the PBS_fast_clear routine.
More...
#include <PBI/PTR.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <malloc.h>
#include <PBS/PBS.h>
#include <PBS/TMR.h>
#include <PBS/CACHE.h>
|
Defines |
#define | PBS_fast_clear PBS_test_fast_clear |
| Redefines the fast clear routine on non-PPC platforms.
|
Functions |
unsigned int | test_clear (void) |
| Main driver for test program, entry point for VxWorks.
|
Detailed Description
Unit test for the PBS_fast_clear routine.
- Author:
- JJRussell - russell@slac.stanford.edu
CVS $Id: test_clear.c,v 1.2 2011/03/24 23:05:45 apw Exp $
- PBS_fast_clear is a PPC specific optimization to quickly clear memory using the DBCZ instruction. The memory being cleared must be cacheable. While the routine functions even with the data cache globally disabled, one reaps none of the speed benefits, since in this case the routine just resorts to a generic clear.
The test can be run from the command line by typing
Define Documentation
#define PBS_fast_clear PBS_test_fast_clear |
Redefines the fast clear routine on non-PPC platforms.
- On non-PPC platforms this entry point is redefined to a test routine which emulates the same logic as the version of PBS_fast_clear found on the PPC platform. Without this redefinition, PBS_fast_clear on non-PPC platforms is defined as the usual library function
- In this way, both the performance of the library function can be used in application code and the logic can tested in this specialized way.
Function Documentation
unsigned int test_clear |
( |
void |
|
) |
|
Main driver for test program, entry point for VxWorks.
- Return values:
-
| 0,Test | succeeded |
| !=0,Test | failed |
- This tests the fast clear function, both functional and performance aspects. The boundary cases are probed and along with making sure the memory is properly zeroed, guard regions around the test region are checked to make sure they are not zeroed.