blob: da168dc0c295c300c818ba9bd42034407cda0d28 [file] [log] [blame]
Qin Zhao7e4933f2016-05-25 17:49:00 +00001//===-- cache_frag.cpp ----------------------------------------------------===//
2//
3// The LLVM Compiler Infrastructure
4//
5// This file is distributed under the University of Illinois Open Source
6// License. See LICENSE.TXT for details.
7//
8//===----------------------------------------------------------------------===//
9//
10// This file is a part of EfficiencySanitizer, a family of performance tuners.
11//
12// This file contains cache fragmentation-specific code.
13//===----------------------------------------------------------------------===//
14
15#include "esan.h"
16
17namespace __esan {
18
Qin Zhao9e396382016-05-31 21:27:39 +000019// This should be kept consistent with LLVM's EfficiencySanitizer StructInfo.
20struct StructInfo {
21 const char *StructName;
22 u32 NumOfFields;
23 u64 *FieldCounters;
24 const char **FieldTypeNames;
25};
26
27// This should be kept consistent with LLVM's EfficiencySanitizer CacheFragInfo.
28// The tool-specific information per compilation unit (module).
29struct CacheFragInfo {
30 const char *UnitName;
31 u32 NumOfStructs;
32 StructInfo *Structs;
33};
34
Qin Zhao7e4933f2016-05-25 17:49:00 +000035//===-- Init/exit functions -----------------------------------------------===//
36
37void processCacheFragCompilationUnitInit(void *Ptr) {
Qin Zhao9e396382016-05-31 21:27:39 +000038 CacheFragInfo *CacheFrag = (CacheFragInfo *)Ptr;
39 VPrintf(2, "in esan::%s: %s with %u class(es)/struct(s)\n",
40 __FUNCTION__, CacheFrag->UnitName, CacheFrag->NumOfStructs);
Qin Zhao7e4933f2016-05-25 17:49:00 +000041}
42
43void processCacheFragCompilationUnitExit(void *Ptr) {
Qin Zhao9e396382016-05-31 21:27:39 +000044 CacheFragInfo *CacheFrag = (CacheFragInfo *)Ptr;
45 VPrintf(2, "in esan::%s: %s with %u class(es)/struct(s)\n",
46 __FUNCTION__, CacheFrag->UnitName, CacheFrag->NumOfStructs);
Qin Zhao7e4933f2016-05-25 17:49:00 +000047}
48
49void initializeCacheFrag() {
50 VPrintf(2, "in esan::%s\n", __FUNCTION__);
51}
52
53int finalizeCacheFrag() {
54 VPrintf(2, "in esan::%s\n", __FUNCTION__);
55 // FIXME: add the cache fragmentation final report.
56 Report("%s is not finished: nothing yet to report\n", SanitizerToolName);
57 return 0;
58}
59
60} // namespace __esan