📄 false_sharing.h
字号:
/* * Copyright (C) 1996-1998 by the Board of Trustees * of Leland Stanford Junior University. * * This file is part of the SimOS distribution. * See LICENSE file for terms of the license. * *//********************************************************************* * false_sharing.h * * Track the false sharing in the caches... enabled by a run-time * option. * * $Author: bosch $ * $Date: 1998/02/10 00:28:56 $ *********************************************************************/#ifndef _FALSE_SHARING_H#define _FALSE_SHARING_H#include "machine_params.h"#ifdef TRACK_FALSE_SHARING#define FALSE_SHARING_ACCESS(_cpu, _fshE, _pA) {\ if (falseSharing) { \ (_fshE->accessedWords |= falseSharingMaskEntries[M_FROM_CPU(_cpu)]\ [_pA&falseSharingMask]); \ } \}#define FALSE_SHARING_MODIFY(_cpu,_pA) \ if (falseSharing) { FalseSharingModify(_cpu,_pA);}#else#define FALSE_SHARING_ACCESS(_cpu, _fshE, _pA) #define FALSE_SHARING_MODIFY(_cpu,_pA) #endif/************************************************************************ * False vs. True Sharing data structures. These are accessed directy by * some time-critical macros. ************************************************************************/typedef uint FalseSharingBV; /* 32 bits. Cluster words if cache line >128 */typedef struct FalseSharingEntry { FalseSharingBV accessedWords; /* bitvector modified on every access */ int categ; /* Type of last miss --> used to classify */ int valid; VA PC; VA vAddr; PA pAddr; int stall; struct StatRecordSnapshot *snap;} FalseSharingEntry;extern void FalseSharingEarlyInit(void);extern void FalseSharingLateInit(void);extern void FalseSharingEvict(int cpuNum, PA pAddr, int way, int type);extern void FalseSharingDefine(int cpuNum, PA pAddr, int way, VA pc, VA vAddr,int stall);extern void FalseSharingDefineOffset(int cpuNum,PA pAddr,int way, int off);extern void FalseSharingModify(int cpuNum, PA pAddr);extern FalseSharingEntry *SCacheLineToFalseSharing(int cpuNum, PA pAddr, int way);extern void FalseSharingCleanup(void);extern FalseSharingBV *falseSharingMaskEntries[MAX_MACHINES];extern uint falseSharingMask;extern bool falseSharing;#endif /* _FALSE_SHARING_H */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -