16e201339SJohn Kariuki /**********************************************************************
26e201339SJohn Kariuki Copyright(c) 2011-2018 Intel Corporation All rights reserved.
36e201339SJohn Kariuki
46e201339SJohn Kariuki Redistribution and use in source and binary forms, with or without
56e201339SJohn Kariuki modification, are permitted provided that the following conditions
66e201339SJohn Kariuki are met:
76e201339SJohn Kariuki * Redistributions of source code must retain the above copyright
86e201339SJohn Kariuki notice, this list of conditions and the following disclaimer.
96e201339SJohn Kariuki * Redistributions in binary form must reproduce the above copyright
106e201339SJohn Kariuki notice, this list of conditions and the following disclaimer in
116e201339SJohn Kariuki the documentation and/or other materials provided with the
126e201339SJohn Kariuki distribution.
136e201339SJohn Kariuki * Neither the name of Intel Corporation nor the names of its
146e201339SJohn Kariuki contributors may be used to endorse or promote products derived
156e201339SJohn Kariuki from this software without specific prior written permission.
166e201339SJohn Kariuki
176e201339SJohn Kariuki THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
186e201339SJohn Kariuki "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
196e201339SJohn Kariuki LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
206e201339SJohn Kariuki A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
216e201339SJohn Kariuki OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
226e201339SJohn Kariuki SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
236e201339SJohn Kariuki LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
246e201339SJohn Kariuki DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
256e201339SJohn Kariuki THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
266e201339SJohn Kariuki (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
276e201339SJohn Kariuki OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
286e201339SJohn Kariuki **********************************************************************/
296e201339SJohn Kariuki
306e201339SJohn Kariuki #include <stdio.h>
316e201339SJohn Kariuki #include <stdlib.h>
32699bb5bdSRoy Oursler #include <string.h>
336e201339SJohn Kariuki #include "mem_routines.h"
346e201339SJohn Kariuki #include "test.h"
356e201339SJohn Kariuki
366e201339SJohn Kariuki #define TEST_LEN 8 * 1024
376e201339SJohn Kariuki #define TEST_TYPE_STR "_warm"
386e201339SJohn Kariuki
39aaa78d6aSMarcel Cornu int
main(int argc,char * argv[])40aaa78d6aSMarcel Cornu main(int argc, char *argv[])
416e201339SJohn Kariuki {
426e201339SJohn Kariuki void *buf;
43699bb5bdSRoy Oursler struct perf start;
446e201339SJohn Kariuki
456e201339SJohn Kariuki printf("Test mem_zero_detect_perf %d bytes\n", TEST_LEN);
466e201339SJohn Kariuki
476e201339SJohn Kariuki if (posix_memalign(&buf, 64, TEST_LEN)) {
486e201339SJohn Kariuki printf("alloc error: Fail");
496e201339SJohn Kariuki return -1;
506e201339SJohn Kariuki }
516e201339SJohn Kariuki
52699bb5bdSRoy Oursler memset(buf, 0, TEST_LEN);
53*4e898eceSPablo de Lara BENCHMARK(&start, BENCHMARK_TIME, isal_zero_detect(buf, TEST_LEN));
546e201339SJohn Kariuki
556e201339SJohn Kariuki printf("mem_zero_detect_perf" TEST_TYPE_STR ": ");
56699bb5bdSRoy Oursler perf_print(start, (long long) TEST_LEN);
576e201339SJohn Kariuki
586e201339SJohn Kariuki return 0;
596e201339SJohn Kariuki }
60