All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.siddhi.sample.benchmark.server.RunningTimeStats Maven / Gradle / Ivy

The newest version!
/**
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing,
 * software distributed under the License is distributed on an
 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
 * KIND, either express or implied. See the License for the
 * specific language governing permissions and limitations
 * under the License.
 */
package org.siddhi.sample.benchmark.server;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.concurrent.atomic.AtomicLong;

public class RunningTimeStats {     // Calculates data to interpret running time stats. 

    public static int[] DEFAULT_MS = new int[]{5, 10, 50, 100, 250, 500, 1000};//ms      
    public static int[] DEFAULT_NS = new int[]{5, 10, 15, 20, 25, 50, 100, 500, 1000, 2500, 5000};//micro secs
    public static int[] EVENT_BASED_SLOTS = new int[]{100, 500, 1000, 2000, 3000, 5000, 10000, 50000, 100000, 1000000};//events
    public static int EVENT_BASED_POINTER = 0;
    public static long EVENT_BASED_TEMPTIMEREF = 0;
    public static long OVERALL_THROUGHPUT =0;


    public static int POINTER = 0;
    public static boolean EVENT_BASED = true;
    public static boolean FINISHED_SENDING = false;

    //    private List timeMapList  = new ArrayList();
    public static Map timeMap = new HashMap();
    public static Map eventMap = new HashMap();

    static {
        for (int i = 0; i < DEFAULT_NS.length; i++)
            DEFAULT_NS[i] *= 1000;//converting to NS
    }

    public RunningTimeStats() {

    }

    public static void addTimeSlot(int timeUpperLimit, long currentEventCounter){
       timeMap.put(timeUpperLimit,currentEventCounter);
    }

    public static void addEventSlot(int eventUpperLimit, long timeExpired){
       eventMap.put(eventUpperLimit,timeExpired);
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy