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-2012 Pentaho 008// All Rights Reserved. 009*/ 010package mondrian.server.monitor; 011 012/** 013 * Information about a Mondrian server. 014 */ 015public class ServerInfo extends Info { 016 public final int connectionStartCount; 017 public final int connectionEndCount; 018 public final int statementStartCount; 019 public final int statementEndCount; 020 public final int sqlStatementStartCount; 021 public final int sqlStatementExecuteCount; 022 public final int sqlStatementEndCount; 023 024 /** 025 * Cumulative number of rows fetched from SQL statements. 026 */ 027 public final long sqlStatementRowFetchCount; 028 029 /** 030 * Cumulative time spent executing SQL statements. 031 */ 032 public final long sqlStatementExecuteNanos; 033 034 /** 035 * Total, over all SQL statements that are fetching cells into cache, of 036 * the number of requested cells that will be satisfied by those SQL 037 * statements. Note that a given SQL statement may round out the predicates 038 * and bring back a few more cells than it was asked for. 039 */ 040 public final int sqlStatementCellRequestCount; 041 public final int cellCacheRequestCount; 042 public final int cellCacheHitCount; 043 public final int cellCacheMissCount; 044 public final int cellCachePendingCount; 045 public final int executeStartCount; 046 public final int executeEndCount; 047 public final long jvmHeapBytesUsed; 048 public final long jvmHeapBytesCommitted; 049 public final long jvmHeapBytesMax; 050 051 /** 052 * The number of segments currently in cache. 053 */ 054 public final int segmentCount; 055 056 /** 057 * The number of segments that have been created since the server started. 058 * (Should equal the sum {@link #segmentCreateViaExternalCount} 059 * + {@link #segmentCreateViaRollupCount} 060 * + {@link #segmentCreateViaSqlCount}.) 061 */ 062 public final int segmentCreateCount; 063 064 /** 065 * The number of segments that have been created via external since the 066 * server started. 067 */ 068 public final int segmentCreateViaExternalCount; 069 070 /** 071 * The number of segments that have been deleted via external since the 072 * server started. 073 */ 074 public final int segmentDeleteViaExternalCount; 075 076 /** 077 * The number of segments that have been created via rollup since the server 078 * started. 079 */ 080 public final int segmentCreateViaRollupCount; 081 082 /** 083 * The number of segments that have been created via SQL since the server 084 * started. 085 */ 086 public final int segmentCreateViaSqlCount; 087 088 /** 089 * The number of cells currently in cache. 090 */ 091 public final int cellCount; 092 093 /** 094 * The sum of the dimensionality of every cells currently in cache. 095 * 096 * <p>For example, each cell in the segment (State={CA, TX} * Year={2011}) 097 * has two coordinates.</p> 098 * 099 * <p>From this, we can compute the average dimensionality of segments 100 * in cache, weighted by the number of cells. It gives an idea of the 101 * memory overhead for segment axes.</p> 102 */ 103 public final int cellCoordinateCount; 104 105 public ServerInfo( 106 String stack, 107 int connectionStartCount, 108 int connectionEndCount, 109 int statementStartCount, 110 int statementEndCount, 111 int sqlStatementStartCount, 112 int sqlStatementExecuteCount, 113 int sqlStatementEndCount, 114 long sqlStatementRowFetchCount, 115 long sqlStatementExecuteNanos, 116 int sqlStatementCellRequestCount, 117 int cellCacheHitCount, 118 int cellCacheRequestCount, 119 int cellCacheMissCount, 120 int cellCachePendingCount, 121 int executeStartCount, 122 int executeEndCount, 123 long jvmHeapBytesUsed, 124 long jvmHeapBytesCommitted, 125 long jvmHeapBytesMax, 126 int segmentCount, 127 int segmentCreateCount, 128 int segmentCreateViaExternalCount, 129 int segmentDeleteViaExternalCount, 130 int segmentCreateViaRollupCount, 131 int segmentCreateViaSqlCount, 132 int cellCount, 133 int cellCoordinateCount) 134 { 135 super(stack); 136 this.connectionStartCount = connectionStartCount; 137 this.connectionEndCount = connectionEndCount; 138 this.statementStartCount = statementStartCount; 139 this.statementEndCount = statementEndCount; 140 this.sqlStatementStartCount = sqlStatementStartCount; 141 this.sqlStatementExecuteCount = sqlStatementExecuteCount; 142 this.sqlStatementEndCount = sqlStatementEndCount; 143 this.sqlStatementRowFetchCount = sqlStatementRowFetchCount; 144 this.sqlStatementExecuteNanos = sqlStatementExecuteNanos; 145 this.sqlStatementCellRequestCount = sqlStatementCellRequestCount; 146 this.cellCacheRequestCount = cellCacheRequestCount; 147 this.cellCacheHitCount = cellCacheHitCount; 148 this.cellCacheMissCount = cellCacheMissCount; 149 this.cellCachePendingCount = cellCachePendingCount; 150 this.executeStartCount = executeStartCount; 151 this.executeEndCount = executeEndCount; 152 this.jvmHeapBytesUsed = jvmHeapBytesUsed; 153 this.jvmHeapBytesCommitted = jvmHeapBytesCommitted; 154 this.jvmHeapBytesMax = jvmHeapBytesMax; 155 this.segmentCount = segmentCount; 156 this.segmentCreateCount = segmentCreateCount; 157 this.segmentCreateViaExternalCount = segmentCreateViaExternalCount; 158 this.segmentDeleteViaExternalCount = segmentDeleteViaExternalCount; 159 this.segmentCreateViaRollupCount = segmentCreateViaRollupCount; 160 this.segmentCreateViaSqlCount = segmentCreateViaSqlCount; 161 this.cellCount = cellCount; 162 this.cellCoordinateCount = cellCoordinateCount; 163 } 164 165 public int cellCacheMissCount() { 166 return cellCacheRequestCount - cellCacheHitCount; 167 } 168 169 /** 170 * @return number of SQL statements currently executing 171 */ 172 public int sqlStatementCurrentlyOpenCount() { 173 return sqlStatementStartCount - sqlStatementEndCount; 174 } 175 176 /** 177 * @return number of statements currently executing 178 */ 179 public int statementCurrentlyExecutingCount() { 180 return executeStartCount - executeEndCount; 181 } 182 183 /** 184 * @return number of statements currently open 185 */ 186 public int statementCurrentlyOpenCount() { 187 return statementStartCount - statementEndCount; 188 } 189 190 /** 191 * @return number of connections currently open 192 */ 193 public int connectionCurrentlyOpenCount() { 194 return connectionStartCount - connectionEndCount; 195 } 196} 197 198// End ServerInfo.java