How to store System.currentTimeMillis() in an array with a park time simulator

151 Views Asked by At

I'm trying to store the time in milliseconds for every time this time park is executed. And then I would like to use HdrHistogram to represent the latency.

However, i can't store the times in my array. Please, could you provide any help?

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

    }
     }
0

There are 0 best solutions below