public async Task <HttpResponseMessage> GetLeaderboardAsync(int?amount, StatisticsType statisticsType) { var uri = new Uri(_httpClient.BaseAddress + $"statistics/leaderboard?amount={amount}&type={statisticsType}"); var response = await _httpClient.GetAsync(uri); return(response); }
public void IncrementStatsValue(StatisticsType type, long value) { if (!_performanceCounters.ContainsKey(type)) { return; } if (_performanceCounters[type] == null) { return; } switch (type) { case StatisticsType.AvgDeleteTime: lock (_performanceCounters[type]) { _performanceCounters[type].IncrementBy(value * 1000000); _performanceCounters[StatisticsType.AvgDeleteTimeBase].Increment(); } break; case StatisticsType.AvgFetchTime: lock (_performanceCounters[type]) { _performanceCounters[type].IncrementBy(value * 1000000); _performanceCounters[StatisticsType.AvgFetchTimeBase].Increment(); } break; case StatisticsType.AvgInsertTime: lock (_performanceCounters[type]) { _performanceCounters[type].IncrementBy(value * 1000000); _performanceCounters[StatisticsType.AvgInsertTimeBase].Increment(); } break; case StatisticsType.AvgQueryExecutionTime: lock (_performanceCounters[type]) { _performanceCounters[type].IncrementBy(value * 1000000); _performanceCounters[StatisticsType.AvgQueryExecutionTimeBase].Increment(); } break; case StatisticsType.AvgUpdateTime: lock (_performanceCounters[type]) { _performanceCounters[type].IncrementBy(value * 1000000); _performanceCounters[StatisticsType.AvgUpdateTimeBase].Increment(); } break; default: lock (_performanceCounters[type]) { _performanceCounters[type].IncrementBy(value); } break; } }
public SingleSeriesStatistics(Func <TObject, string> xAxisMapper, Func <TObject, double> yAxisMapper, StatisticsType type = StatisticsType.Sum, Func <IEnumerable <double>, double> foldMethod = null) { switch (type) { case StatisticsType.Sum: foldMethod = SumCalculator; break; case StatisticsType.Count: foldMethod = CountCalculator; break; case StatisticsType.Average: foldMethod = AverageCalculator; break; case StatisticsType.UserDefine: if (foldMethod == null) { throw new Exception("传入UserDefine类型时,calculator不能为null"); } this.foldMethod = foldMethod; break; default: throw new Exception($"错误的StatisticsType类型{type}"); } XAxisMapper = xAxisMapper; YAxisMapper = yAxisMapper; }
/// <summary> /// Get order history statistics data from Warframe Market. /// </summary> /// <param name="code">Item code</param> /// <param name="type">Chart data are from live or closed</param> /// <returns></returns> public async Task <Statistics> GetWarframeMarketStatisticsAsync(string code, StatisticsType type) { string route = Statics.WM_STATISTICS_URL + $"{code}?platform={Platform}&type={type.ToString().ToLower()}"; var data = await NetworkTools.GetEntityAsync <Statistics>(route, Token, ExceptionAction); return(data); }
private void CmbStatisticsTypeSelectionChanged(object sender, SelectionChangedEventArgs e) { if(e.AddedItems.Count > 0) { _statisticsType = (StatisticsType)e.AddedItems[0]; if (StatisticRangePanel != null && QueryCondionPanel!= null) { if (_statisticsType == StatisticsType.AccountType) { StatisticRangePanel.Visibility = System.Windows.Visibility.Collapsed; QueryCondionPanel.ShowSelectType = false; TxtAverage.Visibility = System.Windows.Visibility.Collapsed; } else { StatisticRangePanel.Visibility = System.Windows.Visibility.Visible; QueryCondionPanel.ShowSelectType = true; TxtAverage.Visibility = System.Windows.Visibility.Visible; } } QueryRecords(); } }
private async Task UpdateAsync(StatisticsType type, int valueToAdd, string team = "") { var q = this.repository.Query; if (type == StatisticsType.MinutesPlayedByAllPlayers) { team = ""; } var st = await q.FirstOrDefaultAsync(s => s.Type.Equals(type) && s.TeamName.Equals(team)); if (st == null) { st = new Statistic(); st.Type = type; st.Name = type.ToString(); st.TeamName = team; await this.repository.AddAsync(st); await this.repository.SaveAsync(); } st.Name = type.ToString(); st.Total += valueToAdd; this.repository.Update(st); await this.repository.SaveAsync(); }
private async Task <string> GetStatistcsAsync(StatisticsType type) { _logger.LogInformation("class LeaderboardMenu. GetStatistcsAsync()"); var options = new string[] { "Set the amount of best players in the rate", "Show all players in the rate" }; var command = MenuLibrary.InputMenuItemNumber("Please, choose", options); var amount = command == 1 ? MenuLibrary.InputIntegerValue("amount", 1, int.MaxValue) : int.MaxValue; var response = await _statisticClient.GetLeaderboardAsync(amount, type); _logger.LogInformation("REQUEST: Sent the request for statistics"); if (response.StatusCode == HttpStatusCode.OK) { _logger.LogInformation("RESPONSE: Got the statistics (200)"); var content = await response.Content.ReadAsStringAsync(); return(content); } else { _logger.LogInformation("RESPONSE: Unknown response"); throw new HttpListenerException(); } }
public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture) { Airport airport = (Airport)value; StatisticsType statType = StatisticsTypes.GetStatisticsType("Passengers"); return(airport.Statistics.getTotalValue(GameObject.GetInstance().GameTime.Year, statType)); }
public static void Add(StatisticsType type, int quantity) { var stats = new Statistics(type); stats.AddToData1(quantity); stats.Save(); }
public static Dictionary <StatisticsType, Dictionary <string, List <StatisticsParameter> > > GetHeadersAndFooters(this ISelectProperties statisticsProperties, int id = MatchedID.Statistics) { Dictionary <StatisticsType, Dictionary <string, List <StatisticsParameter> > > result = new Dictionary <StatisticsType, Dictionary <string, List <StatisticsParameter> > >(); var propertiesAll = statisticsProperties.GetType().GetProperties(); if (propertiesAll != null) { foreach (var property in propertiesAll) { if (property == null || property.IsPropertyUsedByFrameWork()) { continue; } var statisticsAll = property.GetCustomAttributes(typeof(StatisticsAttribute), true)?.Select(w => (StatisticsAttribute)w).Where(w => w.ID == id); foreach (var statistics in statisticsAll) { if (statistics != null) { StatisticsType statisticsType = statistics.SType; string column = statistics.Column; string command = statistics.Command; var extra = statistics.CommandExtra; var sort = statistics.Sort; if (!result.ContainsKey(statisticsType)) { result.Add(statisticsType, new Dictionary <string, List <StatisticsParameter> >()); } if (result.ContainsKey(statisticsType)) { var valueKey = result[statisticsType]; var columnAliasName = property.Name; if (string.IsNullOrEmpty(column)) { column = property.Name; } if (valueKey == null || !valueKey.ContainsKey(command)) { result[statisticsType].Add(command, new List <StatisticsParameter> { new StatisticsParameter { CommandText = column + " " + extra, ColumnAliasName = columnAliasName, Sort = sort } }); } else { result[statisticsType][command].Add(new StatisticsParameter { CommandText = column + " " + extra, ColumnAliasName = columnAliasName, Sort = sort }); } } } } } } return(result); }
/// <summary> /// 根据用户ID和日期,统计的类型返回用户某天的考勤日志数量 /// </summary> /// <param name="ATID">用户ID</param> /// <param name="Date">日期</param> /// <param name="Type">统计的类型</param> public int GetDayCountByType(string UserID, DateTime Date, StatisticsType Type) { string type = Type.ToString(); DateTime Start = Date.Date; DateTime End = Date.AddDays(1).Date; return(_entities.Where(x => x.AL_UserID == UserID && x.AL_Date >= Start && x.AL_Date < End && x.AL_Status == type).Count()); }
public List<ConversationStatistics> GetStatistics(Conversation conversation, DateTime dtFrom, DateTime dtTo, StatisticsType statisticsType) { IMessenger messenger = _messengers[conversation.MessengerType]; IEnumerable<ConversationStatistics> result = messenger.GetConversationStatistics(conversation.Username, conversation.Id, dtFrom, dtTo, statisticsType); return result.ToList(); }
public StatisticsParam(StatisticsType nType, int nInt1, int nInt2, int nInt3, int nInt4) { type = nType; int1 = nInt1; int2 = nInt2; int3 = nInt3; int4 = nInt4; }
public ISourceLinesQueryResult GetTopLines(ulong threadId, StatisticsType statisticsType) { return(SessionThreads.TryGetValue(threadId, out SessionThread x) ? new SourceLinesQueryResult() { StatisticsType = statisticsType, Totals = x.Totals, Lines = x.Lines[statisticsType].Take(TopCount).ToList() } : new SourceLinesQueryResult()); }
public IHotPathsQueryResult GetHotPathes(ulong threadId, StatisticsType statisticsType) { return(SessionThreads.TryGetValue(threadId, out SessionThread x) ? new HotPathsQueryResult() { StatisticsType = statisticsType, Totals = x.Totals, Methods = x.HotPaths[statisticsType].Take(TopCount).ToList() } : new HotPathsQueryResult()); }
public PerfStat(int threadID) { PerfStatType regStatType = PerfStatType.GetInstance(); statsType = regStatType.GetStatType(); StatisticsFactory factory = StatisticsFactory.GetExistingInstance(); string buf = String.Format("ThreadId-{0}", threadID); testStat = factory.CreateStatistics(statsType, buf); }
public RouteIncomePerPaxMVVM(Route route) { StatisticsType stat = StatisticsTypes.GetStatisticsType("Passengers"); this.Route = route; double pax = this.Route.Statistics.getStatisticsValue(stat); this.IncomePerPax = this.Route.Balance / pax; }
//returns the value for a statistics type for a route class public int getStatisticsValue(RouteAirlinerClass aClass, StatisticsType type) { if (this.Stats.ContainsKey(aClass) && this.Stats[aClass].ContainsKey(type)) { return(this.Stats[aClass][type]); } else { return(0); } }
private async Task UpdateMinutesAsync(StatisticsType common, StatisticsParams newValues, StatisticsParams oldValues) { if (oldValues == null) { oldValues = new StatisticsParams(); } var minutes = Math.Max(newValues.Minutes - oldValues.Minutes, 0); await UpdateAsync(common, minutes, newValues.Team); }
//returns the total value for a statistics type for a year public double getTotalValue(int year, StatisticsType type) { if (!this.Stats.ContainsKey(year)) { return(0); } return((from s in this.Stats[year] where s.Stat == type select s.Value).Sum()); }
public void SetItemsSource(ICallTreeQueryResult inputSource, StatisticsType statisticsType) { ItemAdaptor.StatisticsType = statisticsType; ItemAdaptor.Totals = inputSource.Totals; TreeView.ItemsSource = inputSource.CallTree; foreach (var item in inputSource.CallTree) { ((CallStatisticsTreeNode)item).IsExpanded = true; } }
public static IStatisticsGenerator Create(StatisticsType type) { switch (type) { case StatisticsType.Usage: return(new UsageStatisticsGenerator(null)); // TODO: DataSource default: return(null); } }
public async Task UpdateAsync <T>(StatisticsType source, T newValues, T oldValues = null) where T : class { CreateParams(newValues, oldValues, out StatisticsParams stNewValues, out StatisticsParams stOldValues); if (!string.IsNullOrEmpty(stNewValues.Team)) { await UpdateCardsAsync(stNewValues, stOldValues); } await UpdateMinutesAsync(source, stNewValues, stOldValues); }
//returns the total value of a statistics type public long getTotalValue(StatisticsType type) { long value = 0; lock (this.Stats) { value = this.Stats.Where(s => s.Type.Shortname == type.Shortname).Sum(s => s.Value); } return(value); }
internal Battle(Unit[] units, short[] counts, General general, Unit[] enemyUnits, short[] enemyCounts, General enemyGeneral, StatisticsType statisticsType) { KeyValuePair <Unit[], short[]> result = InitializeUnits(units, counts); m_sides = new BattleSide[2]; Sides[(int)BattleSideType.Player] = new BattleSide(result.Key, result.Value, general); result = InitializeUnits(enemyUnits, enemyCounts); Sides[(int)BattleSideType.Enemy] = new BattleSide(result.Key, result.Value, enemyGeneral); m_statisticsType = statisticsType; }
public StatisticsType GetStatType() { StatisticsFactory m_factory = StatisticsFactory.GetExistingInstance(); StatisticsType statsType = m_factory.FindType("cacheperf.CachePerfStats"); if (statsType == null) { statDes[0] = m_factory.CreateIntCounter(PerfOps.PERF_PUTS, "Number of puts completed.", "operations", 1); statDes[1] = m_factory.CreateLongCounter(PerfOps.PERF_PUT_TIME, "Total time spent doing puts.", "nanoseconds", 0); statDes[2] = m_factory.CreateIntCounter(PerfOps.PERF_UPDATE_EVENTS, "Number of update events.", "events", 1); statDes[3] = m_factory.CreateLongCounter(PerfOps.PERF_UPDATE_LATENCY, "Latency of update operations.", "nanoseconds", 0); statDes[4] = m_factory.CreateIntCounter(PerfOps.PERF_CREATES, "Number of creates completed.", "operations", 1); statDes[5] = m_factory.CreateLongCounter(PerfOps.PERF_CREATE_TIME, "Total time spent doing creates.", "nanoseconds", 0); statDes[6] = m_factory.CreateIntCounter(PerfOps.PERF_LATENCY_SPIKES, "Number of latency spikes.", "spikes", 0); statDes[7] = m_factory.CreateIntCounter( PerfOps.PERF_NEGATIVE_LATENCIES, "Number of negative latencies (caused by insufficient clock skew correction).", "negatives", 0); statDes[8] = m_factory.CreateIntCounter(PerfOps.PERF_OPS, "Number of operations completed.", "operations", 1); statDes[9] = m_factory.CreateLongCounter(PerfOps.PERF_OP_TIME, "Total time spent doing operations.", "nanoseconds", 0); statDes[10] = m_factory.CreateIntCounter(PerfOps.PERF_CONNECTS, "Number of connects completed.", "operations", 1); statDes[11] = m_factory.CreateLongCounter(PerfOps.PERF_CONNECT_TIME, "Total time spent doing connects.", "nanoseconds", 0); statDes[12] = m_factory.CreateIntCounter(PerfOps.PERF_DISCONNECTS, "Number of disconnects completed.", "operations", 1); statDes[13] = m_factory.CreateLongCounter(PerfOps.PERF_DISCONNECT_TIME, "Total time spent doing disconnects.", "nanoseconds", 0); statDes[14] = m_factory.CreateIntCounter(PerfOps.PERF_GETS, "Number of gets completed.", "operations", 1); statDes[15] = m_factory.CreateLongCounter(PerfOps.PERF_GET_TIME, "Total time spent doing gets.", "nanoseconds", 0); statDes[16] = m_factory.CreateIntCounter(PerfOps.PERF_QUERIES, "Number of queries completed.", "operations", 1); statDes[17] = m_factory.CreateLongCounter(PerfOps.PERF_QUERY_TIME, "Total time spent doing queries.", "nanoseconds", 0); statDes[18] = m_factory.CreateIntCounter(PerfOps.PERF_UPDATES, "Number of updates completed.", "operations", 1); statDes[19] = m_factory.CreateLongCounter(PerfOps.PERF_UPDATES_TIME, "Total time spent doing updates.", "nanoseconds", 0); statsType = m_factory.CreateType("cacheperf.CachePerfStats", "Application statistics.", statDes, 20); } return(statsType); }
public IStatistics GetStatsByType(StatisticsType type) { foreach (var stats in Statistics) { if (stats.Subtitle.Contains(type.ToString())) { return(stats); } } throw new Exception(); }
/// <summary> /// 查看数据更新条数 /// </summary> /// <param name="requestUrl">API请求地址</param> /// <param name="op">请求类型, 如果值为Get,则忽略type参数值,否则将对应的type类型数据进行清零</param> /// <param name="type">数据类型</param> /// <returns>数据统计报表</returns> public StatisticsData GetStatistics(string requestUrl, StatisticsOperate op, StatisticsType type) { Parameters parameters = new Parameters(); parameters.Add("format", this.ResponseDataFormat.ToString().ToLower()); parameters.Add("op", (byte)op); if (op != StatisticsOperate.Get) { parameters.Add("type", (byte)type); } return(this.GetResponseData <StatisticsData>(requestUrl, parameters)); }
//returns the value for a statistics type for an airline for a year public double getStatisticsValue(int year, Airline airline, StatisticsType type) { if (this.Stats.ContainsKey(year)) { AirportStatisticsValue value = this.Stats[year].Find(asv => asv.Airline == airline && asv.Stat == type); if (value != null) { return(value.Value); } } return(0); }
//creates the airlines statistics private StackPanel createStatisticsPanel(StatisticsType type, Boolean inPercent) { StackPanel panelStatistics = new StackPanel(); panelStatistics.Margin = new Thickness(0, 0, 0, 5); ContentControl ccHeader = new ContentControl(); ccHeader.ContentTemplate = this.Resources["StatHeader"] as DataTemplate; ccHeader.Content = new KeyValuePair <StatisticsType, KeyValuePair <int, int> >(type, new KeyValuePair <int, int>(GameObject.GetInstance().GameTime.Year - 1, GameObject.GetInstance().GameTime.Year)); panelStatistics.Children.Add(ccHeader); ListBox lbStats = new ListBox(); lbStats.ItemContainerStyleSelector = new ListBoxItemStyleSelector(); lbStats.ItemTemplate = inPercent ? this.Resources["StatPercentItem"] as DataTemplate : this.Resources["StatItem"] as DataTemplate; List <Airline> airlines = Airlines.GetAllAirlines().FindAll(a => !a.IsSubsidiary); airlines.Sort((delegate(Airline a1, Airline a2) { return(a1.Profile.Name.CompareTo(a2.Profile.Name)); })); List <KeyValuePair <Airline, StatisticsType> > values = new List <KeyValuePair <Airline, StatisticsType> >(); foreach (Airline airline in airlines) { values.Add(new KeyValuePair <Airline, StatisticsType>(airline, type)); foreach (SubsidiaryAirline sAirline in airline.Subsidiaries) { values.Add(new KeyValuePair <Airline, StatisticsType>(sAirline, type)); } } lbStats.ItemsSource = values; panelStatistics.Children.Add(lbStats); lbToUpdate.Add(lbStats); /* * if (!inPercent) * { * ContentControl ccTotal = new ContentControl(); * ccTotal.Margin = new Thickness(5, 0, 0, 0); * ccTotal.ContentTemplate = this.Resources["StatTotalItem"] as DataTemplate; * ccTotal.Content = type; * * panelStatistics.Children.Add(ccTotal); * } * */ return(panelStatistics); }
//sets the value for a statistics type to a route class public void setStatisticsValue(RouteAirlinerClass aClass, StatisticsType type, int value) { RouteStatisticsItem item = this.Stats.Find(i => i.Type.Shortname == type.Shortname && i.RouteClass == aClass); if (item == null) { this.Stats.Add(new RouteStatisticsItem(aClass, type, value)); } else { item.Value = value; } }
//returns the value for a statistics type for a route class public long getStatisticsValue(RouteAirlinerClass aClass, StatisticsType type) { RouteStatisticsItem item = this.Stats.Find(i => i.Type.Shortname == type.Shortname && i.RouteClass.Type == aClass.Type); if (item == null) { return(0); } else { return(item.Value); } }
public IEnumerable<ConversationStatistics> GetConversationStatistics(string username, long id, DateTime dtFrom, DateTime dtTo, StatisticsType statisticsType) { ViberDA.SetDbPath(ViberPaths.GetPath(username)); var items = statisticsType == StatisticsType.Full ? ViberDA.GetStatistics(id, dtFrom, dtTo) : ViberDA.GetUrlStatistics(id, dtFrom, dtTo); List<ConversationStatistics> results = new List<ConversationStatistics>(); foreach (ViberConversationStatistics item in items) { results.Add(new ConversationStatistics() { ConversationId = (ulong)item.chatId, TotalMessages = item.total_messages, Identity = item.author } ); } return results; }
public IEnumerable<ConversationStatistics> GetConversationStatistics(string username, long id, DateTime dtFrom, DateTime dtTo, StatisticsType statisticsType) { //first we need set to which db we want to connect SkypeDA.SetDbPath(SkypePaths.GetPath(username)); List<SkypeConversationStatistics> items = statisticsType == StatisticsType.Full ? SkypeDA.GetStatistics(id, dtFrom, dtTo) : SkypeDA.GetUrlStatistics(id, dtFrom, dtTo); ; List<ConversationStatistics> results = new List<ConversationStatistics>(); foreach (SkypeConversationStatistics item in items) { results.Add(new ConversationStatistics() { ConversationId = (ulong)item.convo_id, TotalMessages = item.total_messages, Identity = item.author } ); } return results; }
public Statistics[] StatisticsQuery(Guid device, short _service, DateTime start_date, DateTime end_date, StatisticsType type) { if (device == Guid.Empty || _service == 0 || start_date == null || end_date == null || end_date < start_date) throw new ArgumentException(); SessionCheck(); if (!UserIsLoggedIn || !UserHasPermission(User.PERMISSION_STATS)) throw new PermissionDeniedException(); return service.StatisticsQuery(device, _service, start_date, end_date, type, session); }
/// <summary> /// 采用默认API请求地址查看数据更新条数 /// </summary> /// <param name="op">请求类型, 如果值为Get,则忽略type参数值,否则将对应的type类型数据进行清零</param> /// <param name="type">数据类型</param> /// <returns>数据统计报表</returns> private StatisticsData GetStatistics(StatisticsOperate op, StatisticsType type) { return this.GetStatistics("http://open.t.qq.com/api/info/update", op, type); }
public Statistics[] StatisticsQuery(Guid device, short service, DateTime start_date, DateTime end_date, StatisticsType type, Guid session) { if (device == Guid.Empty || service == 0 || start_date == null || end_date == null || end_date < start_date) return null; ClientSession _session = ClientSession.Get(session); if (_session == null) return null; if (!_session.UserIsLoggedIn) return null; if (!_session.UserHasPermission(User.PERMISSION_STATS)) return null; return Data.StoredProcedure.StatisticsQuery(device, service, start_date, end_date, type, _session.Connection); }
public FileSumList GetStatistics(StatisticsType type, int catalogueID, short? partOfBook, short? processingMode, int? modifiedYear, int? modifiedMonth, int? modifiedDay, string userName, int? status) { OperationRepository repository = new OperationRepository(); StatisticsFilter filter = new StatisticsFilter(StatisticsType.TimePeriod); filter.CatalogueID = catalogueID; filter.PartOfBook = (PartOfBook?)partOfBook; filter.UseOCR = (processingMode.HasValue ? (bool?)(processingMode.Value == (short)ProcessingMode.OCR) : null); filter.Year = modifiedYear; filter.Month = modifiedMonth; filter.Day = modifiedDay; filter.UserName = userName; filter.Status = (StatusCode?)status; switch (type) { case StatisticsType.TimePeriod: return repository.GetTimeStatistics(filter); case StatisticsType.Users: return repository.GetUserStatistics(filter); case StatisticsType.Catalogues: return null; default: return null; } }
public StatisticsFilter(StatisticsType c) { this.StatisticsType = StatisticsType; }
/// <summary> /// 查看数据更新条数 /// </summary> /// <param name="requestUrl">API请求地址</param> /// <param name="op">请求类型, 如果值为Get,则忽略type参数值,否则将对应的type类型数据进行清零</param> /// <param name="type">数据类型</param> /// <returns>数据统计报表</returns> public StatisticsData GetStatistics(string requestUrl, StatisticsOperate op, StatisticsType type) { Parameters parameters = new Parameters(); parameters.Add("format", this.ResponseDataFormat.ToString().ToLower()); parameters.Add("op", (byte)op); if (op != StatisticsOperate.Get) { parameters.Add("type", (byte)type); } return this.GetResponseData<StatisticsData>(requestUrl, parameters); }
/// <summary> /// 采用默认API请求地址获取所有数据更新条数并将对应的type类型数据进行清零 /// </summary> /// <param name="type">数据类型</param> /// <returns>数据统计报表</returns> public StatisticsData UpdateStatistics(StatisticsType type) { return this.GetStatistics(StatisticsOperate.Update, type); }