Developer Reference

  • 2020
  • 07/15/2020
  • Public Content
Contents

GetL2CacheSize

Retrieves L2 cache size, in bytes.

Syntax

IppStatus ippGetL2CacheSize(int*
pSize
);
Include Files
ippcore.h
Parameters
pSize
Pointer to an integer number to store the cache size.
Description
The
ippGetL2CacheSize
function retrieves L2 cache size for the CPU on which it is executed. This function is based on function #4 of the CPUID instruction, and therefore works only for the CPUs that support this function. For old and non-Intel CPUs that do not support this CPUID extension, the function returns the
ippStsCpuNotSupportedErr
status. It means that L2 cache size cannot be obtained with the
ippGetL2CacheSize
function and you should use other methods based on a particular CPU specification.
Optimization Notice
Intel's compilers may or may not optimize to the same degree for non-Intel microprocessors for optimizations that are not unique to Intel microprocessors. These optimizations include SSE2, SSE3, and SSSE3 instruction sets and other optimizations. Intel does not guarantee the availability, functionality, or effectiveness of any optimization on microprocessors not manufactured by Intel. Microprocessor-dependent optimizations in this product are intended for use with Intel microprocessors. Certain optimizations not specific to Intel microarchitecture are reserved for Intel microprocessors. Please refer to the applicable product User and Reference Guides for more information regarding the specific instruction sets covered by this notice.
Notice revision #20110804
Return Values
ippStsNoErr
Indicates no error.
ippStsNullPtrErr
Indicates an error condition when the
pSize
pointer is
NULL
.
ippStsNotSupportedCpu
Indicates that the processor is not supported.

Example

/******************************************************************************* * Copyright 2015-2020 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; }

Product and Performance Information

1

Intel's compilers may or may not optimize to the same degree for non-Intel microprocessors for optimizations that are not unique to Intel microprocessors. These optimizations include SSE2, SSE3, and SSSE3 instruction sets and other optimizations. Intel does not guarantee the availability, functionality, or effectiveness of any optimization on microprocessors not manufactured by Intel. Microprocessor-dependent optimizations in this product are intended for use with Intel microprocessors. Certain optimizations not specific to Intel microarchitecture are reserved for Intel microprocessors. Please refer to the applicable product User and Reference Guides for more information regarding the specific instruction sets covered by this notice.

Notice revision #20110804