C Program to determine Levels & Size of Cache

前端 未结 6 973
北海茫月
北海茫月 2020-11-30 00:38

Full Re-Write/Update for clarity (and your sanity, its abit too long) ... (Old Post)

For an assignment, I need to find the levels (L1,L2,...) and si

6条回答
  •  [愿得一人]
    2020-11-30 01:29

    I know this! (In reality it is very complicated because of pre-fetching)

     for (times = 0; times < Max; time++) /* many times*/
         for (i=0; i < ArraySize; i = i + Stride)
               dummy = A[i]; /* touch an item in the array */
    

    Changing stride allows you to test the properties of caches. By looking at a graph you will get your answers.

    Look at slides 35-42 http://www.it.uu.se/edu/course/homepage/avdark/ht11/slides/11_Memory_and_optimization-1.pdf

    Erik Hagersten is a really good teacher (and also really competent, was lead architect at sun at one point) so take a look at the rest of his slides for more great explanations!

提交回复
热议问题