Contents
1 Introduction1
1.1 Caches. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11.2 Algorithms Should Be Cache-Conscious. . . . . . . . . . . . . . . . . . . . . . . . . 21.3 Cache Profiling. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31.3.1 Hardware Performance Counter Based. . . . . . . . . . . . . . . . . . . . . . 31.3.2 Software Simulation Based. . . . . . . . . . . . . . . . . . . . . . . . . . . . 41.4 STL Memory Access Tracer. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6
2 User’s Guide8
2.1 Overview. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 82.2 Obtaining SMAT. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 92.3 Example 1 — Reverse a String. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 92.3.1 Modifying Source for SMAT. . . . . . . . . . . . . . . . . . . . . . . . . . . . 102.3.2 Compiling a Program with SMAT. . . . . . . . . . . . . . . . . . . . . . . . 112.3.3 Measuring Cache Performance. . . . . . . . . . . . . . . . . . . . . . . . . . 112.4 Example 2 — Finding the Minimum and Maximum Elements. . . . . . . . . . . . . 122.4.1 Detailed Cache Analysis. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 132.4.2 Trace File Plotting. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 152.4.3 Operation Counting. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 152.5 Making the Best Use of SMAT. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 172.5.1 Making Algorithms Analyzeable. . . . . . . . . . . . . . . . . . . . . . . . . 182.5.2 More Tips. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 202.6 Advanced Topics. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 202.6.1 Disabling SMAT. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 202.6.2 Viewing Trace Files. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 212.6.3 Changing Cache Parameters. . . . . . . . . . . . . . . . . . . . . . . . . . . . 212.6.4 More Cache Performance Information. . . . . . . . . . . . . . . . . . . . . . 222.6.5 Detailed Operation Counting. . . . . . . . . . . . . . . . . . . . . . . . . . . 24
3 Reference Manual26
3.1 Iterator Adaptor. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 263.1.1 Files. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 263.1.2 Class Declaration. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 263.1.3 Description. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 263.1.4 Type Definitions. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 263.1.5 Constructors, Destructors, and Related Functions. . . . . . . . . . . . . . . . 273.1.6 Public Member Functions. . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27i
Add a Comment