use of com.emc.storageos.systemservices.impl.logsvc.stream.LogFileStream in project coprhd-controller by CoprHD.
the class LogStreamTest method testReadNextLogMaxCountFilterGreaterThanMAXCOUNTOVERFLOW.
/**
* Test max count filter totalCount > maxCount + MAX_OVERFLOW
*
* @throws Exception
*/
@Test
@Ignore
public void testReadNextLogMaxCountFilterGreaterThanMAXCOUNTOVERFLOW() throws Exception {
List<File> files = new ArrayList<File>();
files.add(new File(timeStampFilePath));
// should get 16 log Messages
long maxCount = 10;
int count = 0;
LogRequest req = new LogRequest.Builder().maxCont(maxCount).build();
LogStatusInfo status = new LogStatusInfo();
LogFileStream stream = new LogFileStream("", files, req, status);
while (true) {
LogMessage log = stream.readNextLogMessage();
if (log == null) {
System.out.println("count=" + count);
assertEquals("Total line number should match max count limit", 16, count);
break;
}
count++;
}
}
use of com.emc.storageos.systemservices.impl.logsvc.stream.LogFileStream in project coprhd-controller by CoprHD.
the class LogStreamPerfTest method testPerformanceNoFilter.
/**
* Test performance without filter
*/
@Test
@Ignore
public void testPerformanceNoFilter() throws Exception {
System.out.println("starting testPerformanceNoFilter");
String svcName = "bigFile-dbsvc";
LogRequest req = new LogRequest.Builder().build();
LogStatusInfo status = new LogStatusInfo();
LogFileStream stream = new LogFileStream(svcName, new ArrayList<File>(), req, status);
long startTime = 0;
long endTime = 0;
startTime = System.nanoTime();
while (true) {
LogMessage log = stream.readNextLogMessage();
if (log == null) {
endTime = System.nanoTime();
break;
}
}
double fileSize = (double) stream.getTotalSizeCount() / (1024L * 1024L);
double elapsedTime = (double) (endTime - startTime) / 1000000000.0;
double speed = fileSize / elapsedTime;
// System.out.println("Total files size(after compressed) is " +
// fileSize + "MB. Log messages count is "
// + stream.getTotalLogCount());
// System.out.println("Speed of LogStream without Filter is: " + speed
// + " MB/sed");
System.out.println("Total files size(after decompressing) is 4286.8 MB. Log messages count is " + stream.getTotalLogCount());
System.out.println("Speed of LogStream without Filter is: " + 4286.8 / elapsedTime + " MB/sec and " + stream.getTotalLogCount() / elapsedTime + " logs/sec");
System.out.println("done testPerformanceNoFilter");
}
use of com.emc.storageos.systemservices.impl.logsvc.stream.LogFileStream in project coprhd-controller by CoprHD.
the class LogStreamPerfTest method testPerformanceMultipleFilters.
/**
* Test performance with time, level and pattern filters, the speed should
* be faster than 50 Mbs
*/
@Test
@Ignore
public void testPerformanceMultipleFilters() throws Exception {
System.out.println("starting testPerformanceMultipleFilters");
String svcName = "bigFile-dbsvc";
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).build();
LogStatusInfo status = new LogStatusInfo();
LogFileStream stream = new LogFileStream(svcName, new ArrayList<File>(), req, status);
long startTime = 0;
long endTime = 0;
startTime = System.nanoTime();
while (true) {
LogMessage log = stream.readNextLogMessage();
if (log == null) {
endTime = System.nanoTime();
break;
}
}
double fileSize = (double) stream.getTotalSizeCount() / (1024L * 1024L);
double elapsedTime = (double) (endTime - startTime) / 1000000000.0;
double speed = fileSize / elapsedTime;
System.out.println("Total files size is " + fileSize + "MB. Log messages count is " + stream.getTotalLogCount());
System.out.println("Speed of LogStream with multiple Filters is: " + speed + " Mbs");
System.out.println("Total files size(after decompressing) is 3436.7 MB. Log messages count is " + stream.getTotalLogCount());
System.out.println("Speed of LogStream with multiple Filters is: " + 3436.7 / elapsedTime + " MB/sec");
System.out.println("done testPerformanceMultipleFilters");
}
use of com.emc.storageos.systemservices.impl.logsvc.stream.LogFileStream in project coprhd-controller by CoprHD.
the class LogStreamPerfTest method testPerformanceTimeFilter.
/**
* Test performance with time range filter
*/
@Test
@Ignore
public void testPerformanceTimeFilter() throws Exception {
System.out.println("starting testPerformanceTimeFilter");
String svcName = "bigFile-dbsvc";
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).build();
LogStatusInfo status = new LogStatusInfo();
LogFileStream stream = new LogFileStream(svcName, new ArrayList<File>(), req, status);
long startTime = 0;
long endTime = 0;
startTime = System.nanoTime();
while (true) {
LogMessage log = stream.readNextLogMessage();
if (log == null) {
endTime = System.nanoTime();
break;
}
}
double fileSize = (double) stream.getTotalSizeCount() / (1024L * 1024L);
double elapsedTime = (double) (endTime - startTime) / 1000000000.0;
double speed = fileSize / elapsedTime;
System.out.println("Total files size is " + fileSize + "MB. Log messages count is " + stream.getTotalLogCount());
System.out.println("Speed of LogStream with time range Filter is: " + speed + " Mbs");
System.out.println("Total files size(after decompressing) is 3436.7 MB. Log messages count is " + stream.getTotalLogCount());
System.out.println("Speed of LogStream with time filter is: " + 3436.7 / elapsedTime + " MB/sec");
System.out.println("done testPerformanceTimeFilter");
}
use of com.emc.storageos.systemservices.impl.logsvc.stream.LogFileStream in project coprhd-controller by CoprHD.
the class LogStreamTest method testGetFilePathNullTimeFilters.
/**
* Test if LogStream can find all files need to read correctly And test if
* LogStream can deal null time filter value correctly
* This test can only be tested on root@10.10.191.121
*/
@Test
@Ignore
public void testGetFilePathNullTimeFilters() {
String svcName = "controllersvc";
List<File> files = new ArrayList<File>();
files.add(new File(HARD_CODE_PATH + "/src/main/data/streamData/controllersvc.log.20140110-231105.gz"));
files.add(new File(HARD_CODE_PATH + "/src/main/data/streamData/controllersvc.log.20140114-151216.gz"));
files.add(new File(HARD_CODE_PATH + "/src/main/data/streamData/controllersvc.log.20140112-175108.gz"));
files.add(new File(HARD_CODE_PATH + "/src/main/data/streamData/controllersvc.log.20140116-031010.gz"));
files.add(new File(HARD_CODE_PATH + "/src/main/data/streamData/controllersvc.log"));
files.add(new File(HARD_CODE_PATH + "/src/main/data/streamData/controllersvc.log.20140109-101159.gz"));
LogRequest req = new LogRequest.Builder().build();
LogStatusInfo status = new LogStatusInfo();
LogFileStream stream = new LogFileStream(svcName, files, req, status);
List<String> paths = stream.getLogPaths();
List<String> result = new ArrayList<String>();
result.add(HARD_CODE_PATH + "/src/main/data/streamData/controllersvc.log.20140109-101159.gz");
result.add(HARD_CODE_PATH + "/src/main/data/streamData/controllersvc.log.20140110-231105.gz");
result.add(HARD_CODE_PATH + "/src/main/data/streamData/controllersvc.log.20140112-175108.gz");
result.add(HARD_CODE_PATH + "/src/main/data/streamData/controllersvc.log.20140114-151216.gz");
result.add(HARD_CODE_PATH + "/src/main/data/streamData/controllersvc.log.20140116-031010.gz");
result.add(HARD_CODE_PATH + "/src/main/data/streamData/controllersvc.log");
int i = 0;
assertEquals("Time range and svc filters are not correct", paths.size(), result.size());
for (String str : paths) {
assertEquals("Time range and svc filters are not correct", str, result.get(i));
i++;
}
}
Aggregations