public UnexpectedStatisticRequestException(IndexCostInformation info) : base(String.Format("Unexpected index statistic requested: {0}", info.ToString())) { }
internal void includeInStatistics(int indexId, IndexCostInformation info, float value) { IndexInfo <T> index; var i = _indexes.Where(p => p.IndexID == indexId); if (i.Count() != 1) { throw new WronxIndexIdException(indexId); } else { index = i.Single(); } switch (info) { case IndexCostInformation.OneObjectIndexAdd: index.IndexStatistic.includeObjectIndexed(value); break; case IndexCostInformation.OneObjectIndexRefresh: index.IndexStatistic.includeObjectIndexRefresh(value); break; case IndexCostInformation.OneObjectIndexRemove: index.IndexStatistic.includeObjectRemoved(value); break; case IndexCostInformation.OneObjectSearch: index.IndexStatistic.includeObjectSearch(value); break; case IndexCostInformation.HitRatio: index.IndexStatistic.includeHitRatio(value); break; case IndexCostInformation.OneRoleIndexRefresh: index.IndexStatistic.includeRoleIndexRefresh(value); break; case IndexCostInformation.OneRoleIndexRemove: index.IndexStatistic.includeRoleRemoved(value); break; case IndexCostInformation.OneRoleIndexing: index.IndexStatistic.includeRoleIndexed(value); break; case IndexCostInformation.OneRoleSearch: index.IndexStatistic.includeRoleSearch(value); break; default: throw new UnexpectedStatisticRequestException(info); break; } if (MUTDOD.Server.Common.IndexMechanism.IndexMechanism <T> .GetLoger() != null) { MUTDOD.Server.Common.IndexMechanism.IndexMechanism <T> .GetLoger().Log("IndexMechanism", string.Format("new index statistic {0} with value {1}", info.ToString(), value), MessageLevel.Info); } }
private float getTheoretical(IIndex <T> index, IndexCostType type, IndexCostInformation info, int?theoreticalIndexSize) { IndexOperationCost statisticInfo; switch (info) { case IndexCostInformation.OneObjectSearch: statisticInfo = index.ObjectFindCost(theoreticalIndexSize == null ? 0 : (int)theoreticalIndexSize); break; case IndexCostInformation.OneObjectIndexAdd: statisticInfo = index.ObjectIndexingCost(theoreticalIndexSize == null ? 0 : (int)theoreticalIndexSize); break; case IndexCostInformation.OneObjectIndexRemove: statisticInfo = index.ObjectIndexRemoveCost(theoreticalIndexSize == null ? 0 : (int)theoreticalIndexSize); break; case IndexCostInformation.OneObjectIndexRefresh: statisticInfo = index.ObjectIndexRefreshCost(theoreticalIndexSize == null ? 0 : (int)theoreticalIndexSize); break; case IndexCostInformation.OneRoleIndexRefresh: statisticInfo = index.RoleIndexRefreshCost(theoreticalIndexSize == null ? 0 : (int)theoreticalIndexSize); break; case IndexCostInformation.OneRoleIndexRemove: statisticInfo = index.RoleIndexRemoveCost(theoreticalIndexSize == null ? 0 : (int)theoreticalIndexSize); break; case IndexCostInformation.OneRoleIndexing: statisticInfo = index.RoleIndexingCost(theoreticalIndexSize == null ? 0 : (int)theoreticalIndexSize); break; case IndexCostInformation.OneRoleSearch: statisticInfo = index.RoleFindCost(theoreticalIndexSize == null ? 0 : (int)theoreticalIndexSize); break; default: throw new UnexpectedStatisticRequestException(info); } int ret; switch (type) { case IndexCostType.Optimistic: ret = statisticInfo.OptimisticCost; break; case IndexCostType.Pessimistic: ret = statisticInfo.PessimisticCost; break; case IndexCostType.Average: ret = statisticInfo.AverageCost; break; default: throw new UnexpectedStatisticTypeException(type); } return(ret); }
private float getStatistics(IndexInfo <T> index, IndexCostType type, IndexCostInformation info) { StatisticInfo statisticInfo; switch (info) { case IndexCostInformation.OneObjectSearch: statisticInfo = index.IndexStatistic.ObjectSearch; break; case IndexCostInformation.OneObjectIndexAdd: statisticInfo = index.IndexStatistic.ObjectIndexing; break; case IndexCostInformation.OneObjectIndexRemove: statisticInfo = index.IndexStatistic.ObjectIndexRemove; break; case IndexCostInformation.OneObjectIndexRefresh: statisticInfo = index.IndexStatistic.ObjectIndexRefresh; break; case IndexCostInformation.HitRatio: statisticInfo = index.IndexStatistic.HitRatio; break; case IndexCostInformation.OneRoleIndexRefresh: statisticInfo = index.IndexStatistic.RoleIndexRefresh; break; case IndexCostInformation.OneRoleIndexRemove: statisticInfo = index.IndexStatistic.RoleIndexRemove; break; case IndexCostInformation.OneRoleIndexing: statisticInfo = index.IndexStatistic.RoleIndexing; break; case IndexCostInformation.OneRoleSearch: statisticInfo = index.IndexStatistic.RoleSearch; break; default: throw new UnexpectedStatisticRequestException(info); } float ret; switch (type) { case IndexCostType.Optimistic: ret = statisticInfo.Optimistic; break; case IndexCostType.Pessimistic: ret = statisticInfo.Pessimistic; break; case IndexCostType.Average: ret = statisticInfo.Average; break; default: throw new UnexpectedStatisticTypeException(type); } return(ret); }
internal float GetStatistic(int indexId, IndexCostSource src, IndexCostType type, IndexCostInformation info, int?theoreticalIndexSize) { IndexInfo <T> index; var i = _indexes.Where(p => p.IndexID == indexId); if (i.Count() != 1) { throw new WronxIndexIdException(indexId); } else { index = i.Single(); } switch (src) { case IndexCostSource.Statistic: return(getStatistics(index, type, info)); case IndexCostSource.Theoretic: return(getTheoretical(GetIndex(indexId), type, info, theoreticalIndexSize)); default: throw new UnexpectedStatisticSourceException(src); } }
public float GetStatistic(int indexID, IndexCostSource src, IndexCostType type, IndexCostInformation info, int?theoreticalIndexSize) { return(global::IndexMechanism.IndexManager.IndexManager <T> .GetInstance().GetStatistic(indexID, src, type, info, theoreticalIndexSize)); }