Search in sources :

Example 16 with LogStopWatch

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;
}
Also used : LogEvent(com.serotonin.m2m2.rt.console.LogEvent) LogStopWatch(com.serotonin.log.LogStopWatch)

Example 17 with LogStopWatch

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;
}
Also used : LogStopWatch(com.serotonin.log.LogStopWatch)

Example 18 with LogStopWatch

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);
}
Also used : LogStopWatch(com.serotonin.log.LogStopWatch)

Example 19 with LogStopWatch

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;
}
Also used : LogEvent(com.serotonin.m2m2.rt.console.LogEvent) LogStopWatch(com.serotonin.log.LogStopWatch)

Example 20 with LogStopWatch

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("");
}
Also used : ArrayList(java.util.ArrayList) UserEventCache(com.serotonin.m2m2.rt.event.UserEventCache) LogStopWatch(com.serotonin.log.LogStopWatch)

Aggregations

LogStopWatch (com.serotonin.log.LogStopWatch)45 IdPointValueTime (com.serotonin.m2m2.rt.dataImage.IdPointValueTime)9 PointValueTime (com.serotonin.m2m2.rt.dataImage.PointValueTime)9 ResultSet (java.sql.ResultSet)3 LogEvent (com.serotonin.m2m2.rt.console.LogEvent)2 IOException (java.io.IOException)2 PreparedStatement (java.sql.PreparedStatement)2 Simplify (com.goebl.simplify.Simplify)1 DataPointVOPointValueTimeBookend (com.infiniteautomation.mango.rest.v2.model.pointValue.DataPointVOPointValueTimeBookend)1 ModuleNotLoadedException (com.serotonin.ModuleNotLoadedException)1 ShouldNeverHappenException (com.serotonin.ShouldNeverHappenException)1 UserEventCache (com.serotonin.m2m2.rt.event.UserEventCache)1 LongPair (com.serotonin.m2m2.vo.pair.LongPair)1 SQLException (java.sql.SQLException)1 ArrayList (java.util.ArrayList)1 Record (org.jooq.Record)1 Record1 (org.jooq.Record1)1 DataAccessException (org.springframework.dao.DataAccessException)1 RowMapper (org.springframework.jdbc.core.RowMapper)1