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 * Event signalling the start of a phase of executing an MDX statement.
014 *
015 * <p>A phase begins when Mondrian has tried to execute a statement and has
016 * determined that it needs cell values in order to give the complete, correct
017 * result. It generates one or more SQL statements to load those cells, and
018 * starts a new phase. Most MDX statements can be completed in 3 or fewer
019 * phases.</p>
020 */
021public class ExecutionPhaseEvent extends ExecutionEvent {
022    public final int phase;
023    public final int hitCount;
024    public final int missCount;
025    public final int pendingCount;
026
027    /**
028     * Creates an ExecutionPhaseEvent.
029     *
030     * @param timestamp Timestamp
031     * @param serverId Server id
032     * @param connectionId Connection id
033     * @param statementId Statement id
034     * @param executionId Execution id
035     * @param phase Phase
036     * @param hitCount Cache hits this phase
037     * @param missCount Cache misses this phase
038     * @param pendingCount Cache entries hit but not ready this phase
039     */
040    public ExecutionPhaseEvent(
041        long timestamp,
042        int serverId,
043        int connectionId,
044        long statementId,
045        long executionId,
046        int phase,
047        int hitCount,
048        int missCount,
049        int pendingCount)
050    {
051        super(timestamp, serverId, connectionId, statementId, executionId);
052        this.phase = phase;
053        this.hitCount = hitCount;
054        this.missCount = missCount;
055        this.pendingCount = pendingCount;
056    }
057
058    @Override
059    public String toString() {
060        return "ExecutionPhaseEvent(" + executionId + ", " + phase + ")";
061    }
062
063    public <T> T accept(Visitor<T> visitor) {
064        return visitor.visit(this);
065    }
066}
067
068// End ExecutionPhaseEvent.java