/*******************************************************************************
* Copyright 2015-2018 Intel Corporation.
*
* This software and the related documents are Intel copyrighted  materials,  and
* your use of  them is  governed by the  express license  under which  they were
* provided to you (License).  Unless the License provides otherwise, you may not
* use, modify, copy, publish, distribute,  disclose or transmit this software or
* the related documents without Intel's prior written permission.
*
* This software and the related documents  are provided as  is,  with no express
* or implied  warranties,  other  than those  that are  expressly stated  in the
* License.
*******************************************************************************/

#include <stdio.h>
#include "ipp.h"

static char* cacheType[] = {
    "Data Cache",
    "Instruction Cache",
    "Unified Cache"
};

int main(){
    IppCache* pCacheInfo;
    int i;
    IppStatus sts;

    sts = ippGetCacheParams( &pCacheInfo );
    if( sts != ippStsNoErr ){
        printf("Intel(R) Integrated Primitives (Intel(R) IPP) function returned error %s\n", ippGetStatusString( sts ));
        return 0;
    }
    i = 0;
    do{
        printf("cache type  = %s\n", cacheType[pCacheInfo[i].type-1] );
        printf("cache level = %d\n", pCacheInfo[i].level );
        printf("cache size  = %d\n", pCacheInfo[i].size );
        printf("+--------------------------------------+\n" );
    } while( pCacheInfo[++i].type > 0 );

    sts = ippGetL2CacheSize( &i );
    printf("\nCache L2 size = %d\n", i );

    return 0;
}