0

每次执行此时间公园时,我都试图以毫秒为单位存储时间。然后我想用 HdrHistogram 来表示延迟。

但是,我无法将时间存储在我的数组中。请问,你能提供任何帮助吗?

public class PracticeLatency1
{
 public static void main(String [] args)
{
int[] startTimes;
long startTime;
int index=0;

 startTimes = new int[10000];
 startTime = System.currentTimeMillis();
 runCalculations();
 startTimes[index++] = (int) (System.currentTimeMillis() - startTime);
 System.out.println(startTimes);
}
   /**
    * Run the practice calculations
    */
   // System.currentTimeMillis()
    private static void runCalculations()
    {
    // Create a random park time simulator
    BaseSyncOpSimulator syncOpSimulator = new SyncOpSimulRndPark(TimeUnit.NANOSECONDS.toNanos(100), 
    TimeUnit.MICROSECONDS.toNanos(100));

    // Execute the operation lot of times
    for(int i = 0; i < 10000; i++)
    {
        syncOpSimulator.executeOp();
        
    }  
     
    // TODO Show the percentile distribution of the latency calculation of each executeOp call

    }
     }
4

0 回答 0