use of com.serotonin.log.LogStopWatch in project ma-core-public by infiniteautomation.
the class LoggingDaoMetrics method getLogs.
/* (non-Javadoc)
* @see com.serotonin.m2m2.db.dao.logging.LoggingDao#getLogs(long, long, int)
*/
@Override
public List<LogEvent> getLogs(long from, long to, int level, int limit) {
LogStopWatch LogStopWatch = new LogStopWatch();
List<LogEvent> values = dao.getLogs(from, to, level, limit);
LogStopWatch.stop("getLogs(from, to, level) (" + from + ", " + to + ", " + level + "){" + values.size() + "}", this.metricsThreshold);
return values;
}
use of com.serotonin.log.LogStopWatch in project ma-core-public by infiniteautomation.
the class LoggingDaoMetrics method dateRangeCount.
/* (non-Javadoc)
* @see com.serotonin.m2m2.db.dao.logging.LoggingDao#dateRangeCount(int, long, long)
*/
@Override
public long dateRangeCount(long from, long to, int level) {
LogStopWatch LogStopWatch = new LogStopWatch();
long count = dao.dateRangeCount(from, to, level);
LogStopWatch.stop("dateRangeCount(from, to, level) (" + from + ", " + to + ", " + level + "){" + count + "}", this.metricsThreshold);
return count;
}
use of com.serotonin.log.LogStopWatch in project ma-core-public by infiniteautomation.
the class LoggingDaoMetrics method log.
/* (non-Javadoc)
* @see com.serotonin.m2m2.db.dao.logging.LoggingDao#log(com.serotonin.m2m2.vo.logging.LogEventVO)
*/
@Override
public void log(LogEvent event) {
LogStopWatch LogStopWatch = new LogStopWatch();
dao.log(event);
LogStopWatch.stop("log(event)", this.metricsThreshold);
}
use of com.serotonin.log.LogStopWatch in project ma-core-public by infiniteautomation.
the class LoggingDaoMetrics method getLogs.
/* (non-Javadoc)
* @see com.serotonin.m2m2.db.dao.logging.LoggingDao#getLogs(long, long, int)
*/
@Override
public List<LogEvent> getLogs(long from, long to, List<Integer> levels, int limit) {
LogStopWatch LogStopWatch = new LogStopWatch();
String sqlIn = "[";
for (int i = 0; i < levels.size(); i++) {
sqlIn += levels.get(i);
if (i < levels.size())
sqlIn += ",";
}
sqlIn += "]";
List<LogEvent> values = dao.getLogs(from, to, levels, limit);
LogStopWatch.stop("getLogs(from, to, levels) (" + from + ", " + to + ", " + sqlIn + "){" + values.size() + "}", this.metricsThreshold);
return values;
}
use of com.serotonin.log.LogStopWatch in project ma-core-public by infiniteautomation.
the class UserEventCacheTest method benchmark.
/**
* To simulate Mango we will have 1 thread generating events
* and occasionally purging them while several other threads read their user's events out.
*/
// @Test(timeout = 30000)
public void benchmark() {
this.cache = new UserEventCache(15 * 60000, 60000);
// Setup EventThread
EventGeneratorThread egt = new EventGeneratorThread(this);
// Setup User Threads
List<UserThread> userThreads = new ArrayList<UserThread>();
for (int i = 0; i < USER_COUNT; i++) {
userThreads.add(new UserThread(i, this));
}
LogStopWatch timer = new LogStopWatch();
// Start User Threads
for (UserThread ut : userThreads) ut.start();
// Start Event Thread
egt.start();
try {
Thread.sleep(50);
} catch (InterruptedException e) {
fail(e.getMessage());
}
while (runningThreads.intValue() > 0) {
synchronized (monitor) {
try {
monitor.wait();
} catch (InterruptedException e) {
fail(e.getMessage());
}
}
}
timer.stop("");
}
Aggregations