Search in sources :

Example 1 with LogStreamMerger

use of com.emc.storageos.systemservices.impl.logsvc.merger.LogStreamMerger in project coprhd-controller by CoprHD.

the class LogStreamMergerTest method testMergeSortCorrectness.

/**
 * Test if merge process can result correct content
 */
@Test
@Ignore
public void testMergeSortCorrectness() throws Exception {
    List<String> svcs = new ArrayList<String>() {

        {
            add("controllersvc");
            add("coordinatorsvc");
        }
    };
    LogRequest req = new LogRequest.Builder().baseNames(svcs).build();
    LogStreamMerger merger = new LogStreamMerger(req, propertiesLoader);
    long prevTime = -1;
    while (true) {
        LogMessage log = merger.readNextMergedLogMessage();
        if (log == null) {
            break;
        }
        long time = log.getTime();
        assertTrue("Output of StreamMerger should be sorted.", prevTime <= time);
        prevTime = time;
    }
}
Also used : LogRequest(com.emc.vipr.model.sys.logging.LogRequest) ArrayList(java.util.ArrayList) LogStreamMerger(com.emc.storageos.systemservices.impl.logsvc.merger.LogStreamMerger) Ignore(org.junit.Ignore) Test(org.junit.Test)

Example 2 with LogStreamMerger

use of com.emc.storageos.systemservices.impl.logsvc.merger.LogStreamMerger in project coprhd-controller by CoprHD.

the class LogStreamMergerPerfTest method testMergePerformance.

@Test
public void testMergePerformance() throws Exception {
    List<String> svcs = new ArrayList<String>() {

        {
            add("controllersvc");
            add("coordinatorsvc");
            add("apisvc");
        }
    };
    LogRequest req = new LogRequest.Builder().baseNames(svcs).build();
    LogStreamMerger merger = new LogStreamMerger(req, propertiesLoader);
    long startTime = System.nanoTime();
    while (true) {
        LogMessage log = merger.readNextMergedLogMessage();
        if (log == null) {
            break;
        }
    }
    long endTime = System.nanoTime();
    int num = merger.getStreamList().length;
    long totalSize = 0;
    for (int i = 0; i < num; i++) {
        totalSize += merger.getStreamList()[i].getTotalSizeCount();
    }
    totalSize = totalSize / (1024L * 1024L);
    double elapsedTime = (double) (endTime - startTime) / 1000000000.0;
    System.out.println("Total read " + totalSize + " MB;" + " Used " + elapsedTime + " sec; Average " + (totalSize / elapsedTime) + " MB/sec.");
}
Also used : LogRequest(com.emc.vipr.model.sys.logging.LogRequest) LogMessage(com.emc.storageos.systemservices.impl.logsvc.LogMessage) ArrayList(java.util.ArrayList) LogStreamMerger(com.emc.storageos.systemservices.impl.logsvc.merger.LogStreamMerger) Test(org.junit.Test)

Example 3 with LogStreamMerger

use of com.emc.storageos.systemservices.impl.logsvc.merger.LogStreamMerger in project coprhd-controller by CoprHD.

the class LogStreamMergerPerfTest method testMergePerformanceTimeRangeFilter.

@Test
@Ignore
public void testMergePerformanceTimeRangeFilter() throws Exception {
    List<String> svcs = new ArrayList<String>() {

        {
            add("controllersvc");
            add("coordinatorsvc");
            add("apisvc");
        }
    };
    Calendar calendar = Calendar.getInstance();
    calendar.set(2013, 10, 20, 16, 38, 16);
    Date startTimeFilter = calendar.getTime();
    calendar.set(2014, 0, 16, 16, 38, 0);
    Date endTimeFilter = calendar.getTime();
    LogRequest req = new LogRequest.Builder().startTime(startTimeFilter).endTime(endTimeFilter).baseNames(svcs).build();
    LogStreamMerger merger = new LogStreamMerger(req, propertiesLoader);
    long startTime = System.nanoTime();
    while (true) {
        LogMessage log = merger.readNextMergedLogMessage();
        if (log == null) {
            break;
        }
    }
    long endTime = System.nanoTime();
    int num = merger.getStreamList().length;
    long totalSize = 0;
    for (int i = 0; i < num; i++) {
        totalSize += merger.getStreamList()[i].getTotalSizeCount();
    }
    totalSize = totalSize / (1024L * 1024L);
    double elapsedTime = (double) (endTime - startTime) / 1000000000.0;
    System.out.println("Performance with time range filter");
    System.out.println("Total read " + totalSize + " MB;" + " Average " + (totalSize / elapsedTime) + " MB/sec.");
}
Also used : LogRequest(com.emc.vipr.model.sys.logging.LogRequest) LogMessage(com.emc.storageos.systemservices.impl.logsvc.LogMessage) Calendar(java.util.Calendar) ArrayList(java.util.ArrayList) LogStreamMerger(com.emc.storageos.systemservices.impl.logsvc.merger.LogStreamMerger) Date(java.util.Date) Ignore(org.junit.Ignore) Test(org.junit.Test)

Example 4 with LogStreamMerger

use of com.emc.storageos.systemservices.impl.logsvc.merger.LogStreamMerger in project coprhd-controller by CoprHD.

the class LogStreamMergerPerfTest method testMergePerformanceMultipleFilters.

@Test
@Ignore
public void testMergePerformanceMultipleFilters() throws Exception {
    List<String> svcs = new ArrayList<String>() {

        {
            add("controllersvc");
            add("coordinatorsvc");
            add("apisvc");
        }
    };
    String pattern = "Memory";
    Calendar calendar = Calendar.getInstance();
    calendar.set(2013, 10, 20, 16, 38, 16);
    Date startTimeFilter = calendar.getTime();
    calendar.set(2014, 0, 16, 16, 38, 0);
    Date endTimeFilter = calendar.getTime();
    LogRequest req = new LogRequest.Builder().startTime(startTimeFilter).endTime(endTimeFilter).logLevel(7).regex(pattern).baseNames(svcs).build();
    LogStreamMerger merger = new LogStreamMerger(req, propertiesLoader);
    long startTime = System.nanoTime();
    while (true) {
        LogMessage log = merger.readNextMergedLogMessage();
        if (log == null) {
            break;
        }
    }
    long endTime = System.nanoTime();
    int num = merger.getStreamList().length;
    long totalSize = 0;
    for (int i = 0; i < num; i++) {
        totalSize += merger.getStreamList()[i].getTotalSizeCount();
    }
    totalSize = totalSize / (1024L * 1024L);
    double elapsedTime = (double) (endTime - startTime) / 1000000000.0;
    System.out.println("Performance with time, level, pattern filters");
    System.out.println("Total read " + totalSize + " MB;" + " Average " + (totalSize / elapsedTime) + " MB/sec.");
}
Also used : LogRequest(com.emc.vipr.model.sys.logging.LogRequest) LogMessage(com.emc.storageos.systemservices.impl.logsvc.LogMessage) Calendar(java.util.Calendar) ArrayList(java.util.ArrayList) LogStreamMerger(com.emc.storageos.systemservices.impl.logsvc.merger.LogStreamMerger) Date(java.util.Date) Ignore(org.junit.Ignore) Test(org.junit.Test)

Aggregations

LogStreamMerger (com.emc.storageos.systemservices.impl.logsvc.merger.LogStreamMerger)4 LogRequest (com.emc.vipr.model.sys.logging.LogRequest)4 ArrayList (java.util.ArrayList)4 Test (org.junit.Test)4 LogMessage (com.emc.storageos.systemservices.impl.logsvc.LogMessage)3 Ignore (org.junit.Ignore)3 Calendar (java.util.Calendar)2 Date (java.util.Date)2