Team Ai
Datasetpublic

hschumann2/TempleOS-Source-Code

sourceHugging Faceupdated 1y agoView on Hugging Face
0likes847downloads
TimeIns.txt37 linesDownload Raw Back to Demo
1 2/*Allows you to time insts.3Results vary because the CPU does4parallel and out-of-order execution.5*/6 7#define SAMPLE_SIZE     100000008 9U0 TimeIns()10{11  I64 i,start,end,overhead_time,test_time;12  F64 d=5.0;13 14  //Measure Loop Overhead15  start=GetTSC;16  for (i=0;i<SAMPLE_SIZE;i++);17  end=GetTSC;18  overhead_time=end-start;19  "\nOverhead Cycles:%12.6f\n",ToF64(overhead_time)/SAMPLE_SIZE;20 21  start=GetTSC;22  for (i=0;i<SAMPLE_SIZE;i++) {23    #exe {PassTrace(0b10000000000);};24//Time these insts25    d*=1.00001;26    #exe {PassTrace(0);};27  }28  end=GetTSC;29  test_time=end-start;30 31  "Measured Cycles:%12.6f\n",ToF64(test_time-overhead_time)/SAMPLE_SIZE;32}33 34TimeIns;35TimeIns;36TimeIns;37