Team Ai
Datasetpublic

hschumann2/TempleOS-Source-Code

sourceHugging Faceupdated 1y agoView on Hugging Face
0likes847downloads
AndNotMod.txt46 linesDownload Raw Back to Lectures
1 2//You may wonder why I use "&" instead of "%".3 4#define SAMPLE_SIZE     1000000005 6U0 TimeIns()7{8  I64 start1,end1,start2,end2,overhead_time,test_time;9  I64 reg i,reg tmp;10 11  CPURep;12 13  //Measure Loop Overhead14  start1=GetTSC;15  for (i=0;i<SAMPLE_SIZE;i++) {16  }17  end1=GetTSC;18  overhead_time=end1-start1;19 20  //Measure remainder...21  start2=GetTSC;22  for (i=0;i<SAMPLE_SIZE;i++)23    tmp=i%0x400;24  end2=GetTSC;25  test_time=end2-start2;26  "Remainder Version #1 Cycles\t: %10.5f\n",27        ToF64(test_time-overhead_time)/SAMPLE_SIZE;28 29  //Measure remainder...30  start2=GetTSC;31  for (i=0;i<SAMPLE_SIZE;i++)32    tmp=i&0x3FF;33  end2=GetTSC;34  test_time=end2-start2;35  "Remainder Version #2 Cycles\t: %10.5f\n",36        ToF64(test_time-overhead_time)/SAMPLE_SIZE;37}38 39TimeIns;40 41/*  Program Output428 Cores 2.660GHz43Remainder Version #1 Cycles     :   26.8534544Remainder Version #2 Cycles     :   -0.0080045*/46