private int getPenaltyForPlayingTracks(NodeStatisticsMessage statistics) { int count = statistics.playingTrackCount; int penalty = System.Math.Min(count, 100); if (count > 100) { penalty += int.Parse(System.Math.Pow(count - 100.0, 0.7).ToString()); } return(penalty * 3 / 2); }
private int getPenaltyForCpuUsage(NodeStatisticsMessage statistics) { return((int)((1.0f / ((1.0f - System.Math.Min(statistics.systemCpuUsage, 0.99f)) / 30.0f)) - 30.0f)); }
private int getPenaltyForPausedTracks(NodeStatisticsMessage statistics) { return(statistics.totalTrackCount - statistics.playingTrackCount); }
private bool isUnavailableForTracks(NodeStatisticsMessage statistics) { return(statistics == null || connectionState.get() != ConnectionState.ONLINE.id()); }
private void handleNodeStatistics(NodeStatisticsMessage message) { log.LogTrace("Received stats from node: {} {} {} {}", message.playingTrackCount, message.totalTrackCount, message.processCpuUsage, message.systemCpuUsage); lastStatistics = message; }