001/*
002// This software is subject to the terms of the Eclipse Public License v1.0
003// Agreement, available at the following URL:
004// http://www.eclipse.org/legal/epl-v10.html.
005// You must accept the terms of that agreement to use this software.
006//
007// Copyright (C) 2011-2011 Pentaho
008// All Rights Reserved.
009*/
010package mondrian.server.monitor;
011
012/**
013 * Information about a statement executed by Mondrian.
014 */
015public class StatementInfo extends Info {
016    public final long statementId;
017    public final int executeStartCount;
018    public final int executeEndCount;
019    public final int phaseCount;
020    public final long cellCacheRequestCount;
021    public final long cellCacheHitCount;
022    public final long cellCacheMissCount;
023    public final long cellCachePendingCount;
024    public final int sqlStatementStartCount;
025    public final int sqlStatementExecuteCount;
026    public final int sqlStatementEndCount;
027    public final long sqlStatementRowFetchCount;
028    public final long sqlStatementExecuteNanos;
029    public final int cellRequestCount;
030
031    public StatementInfo(
032        String stack,
033        long statementId,
034        int executeStartCount,
035        int executeEndCount,
036        int phaseCount,
037        long cellCacheRequestCount,
038        long cellCacheHitCount,
039        long cellCacheMissCount,
040        long cellCachePendingCount,
041        int sqlStatementStartCount,
042        int sqlStatementExecuteCount,
043        int sqlStatementEndCount,
044        long sqlStatementRowFetchCount,
045        long sqlStatementExecuteNanos,
046        int cellRequestCount)
047    {
048        super(stack);
049        this.statementId = statementId;
050        this.cellCacheRequestCount = cellCacheRequestCount;
051        this.phaseCount = phaseCount;
052        this.cellCacheHitCount = cellCacheHitCount;
053        this.cellCacheMissCount = cellCacheMissCount;
054        this.cellCachePendingCount = cellCachePendingCount;
055        this.executeStartCount = executeStartCount;
056        this.executeEndCount = executeEndCount;
057        this.sqlStatementStartCount = sqlStatementStartCount;
058        this.sqlStatementExecuteCount = sqlStatementExecuteCount;
059        this.sqlStatementEndCount = sqlStatementEndCount;
060        this.sqlStatementRowFetchCount = sqlStatementRowFetchCount;
061        this.sqlStatementExecuteNanos = sqlStatementExecuteNanos;
062        this.cellRequestCount = cellRequestCount;
063    }
064
065    /**
066     * @return Whether the statement is currently executing.
067     */
068    public boolean executing() {
069        return executeStartCount > executeEndCount;
070    }
071}
072
073// End StatementInfo.java