Vector Optimized Library of Kernels  2.5.0
Architecture-tuned implementations of math kernels
cpu_features_cache_info.h
Go to the documentation of this file.
1 // Copyright 2017 Google LLC
2 //
3 // Licensed under the Apache License, Version 2.0 (the "License");
4 // you may not use this file except in compliance with the License.
5 // You may obtain a copy of the License at
6 //
7 // http://www.apache.org/licenses/LICENSE-2.0
8 //
9 // Unless required by applicable law or agreed to in writing, software
10 // distributed under the License is distributed on an "AS IS" BASIS,
11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 // See the License for the specific language governing permissions and
13 // limitations under the License.
14 
15 #ifndef CPU_FEATURES_INCLUDE_CPUINFO_COMMON_H_
16 #define CPU_FEATURES_INCLUDE_CPUINFO_COMMON_H_
17 
18 #include "cpu_features_macros.h"
19 
21 
22 typedef enum {
32 
33 typedef struct {
34  int level;
36  int cache_size; // Cache size in bytes
37  int ways; // Associativity, 0 undefined, 0xFF fully associative
38  int line_size; // Cache line size in bytes
39  int tlb_entries; // number of entries for TLB
40  int partitioning; // number of lines per sector
42 
43 // Increase this value if more cache levels are needed.
44 #ifndef CPU_FEATURES_MAX_CACHE_LEVEL
45 #define CPU_FEATURES_MAX_CACHE_LEVEL 10
46 #endif
47 typedef struct {
48  int size;
50 } CacheInfo;
51 
53 
54 #endif // CPU_FEATURES_INCLUDE_CPUINFO_COMMON_H_
CacheType
Definition: cpu_features_cache_info.h:22
@ CPU_FEATURE_CACHE_DATA
Definition: cpu_features_cache_info.h:24
@ CPU_FEATURE_CACHE_STLB
Definition: cpu_features_cache_info.h:29
@ CPU_FEATURE_CACHE_UNIFIED
Definition: cpu_features_cache_info.h:26
@ CPU_FEATURE_CACHE_TLB
Definition: cpu_features_cache_info.h:27
@ CPU_FEATURE_CACHE_DTLB
Definition: cpu_features_cache_info.h:28
@ CPU_FEATURE_CACHE_PREFETCH
Definition: cpu_features_cache_info.h:30
@ CPU_FEATURE_CACHE_INSTRUCTION
Definition: cpu_features_cache_info.h:25
@ CPU_FEATURE_CACHE_NULL
Definition: cpu_features_cache_info.h:23
#define CPU_FEATURES_MAX_CACHE_LEVEL
Definition: cpu_features_cache_info.h:45
#define CPU_FEATURES_START_CPP_NAMESPACE
Definition: cpu_features_macros.h:114
#define CPU_FEATURES_END_CPP_NAMESPACE
Definition: cpu_features_macros.h:115
Definition: cpu_features_cache_info.h:47
int size
Definition: cpu_features_cache_info.h:48
Definition: cpu_features_cache_info.h:33
int tlb_entries
Definition: cpu_features_cache_info.h:39
int cache_size
Definition: cpu_features_cache_info.h:36
int partitioning
Definition: cpu_features_cache_info.h:40
int level
Definition: cpu_features_cache_info.h:34
CacheType cache_type
Definition: cpu_features_cache_info.h:35
int line_size
Definition: cpu_features_cache_info.h:38
int ways
Definition: cpu_features_cache_info.h:37