Skip to content

Commit

Permalink
add ftime
Browse files Browse the repository at this point in the history
  • Loading branch information
Quake4 committed Jan 2, 2018
1 parent ce4ea1e commit 60cd8c5
Show file tree
Hide file tree
Showing 4 changed files with 35 additions and 7 deletions.
2 changes: 1 addition & 1 deletion Code/Config.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ class Config : BaseConfig {
static [int] $Processors = 0
static [int] $Cores = 0
static [int] $Threads = 0
static [string] $Version = "v0.19"
static [string] $Version = "v0.20"
static [string] $BinLocation = "Bin"
static [eMinerType[]] $ActiveTypes
static [string[]] $CPUFeatures
Expand Down
12 changes: 12 additions & 0 deletions Code/SummaryInfo.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ class SummaryInfo {
[Diagnostics.Stopwatch] $TotalTime
[Diagnostics.Stopwatch] $LoopTime
[Diagnostics.Stopwatch] $FeeTime
[Diagnostics.Stopwatch] $FeeCurTime
[Diagnostics.Stopwatch] $RateTime
[timespan] $RateTimeout

Expand All @@ -17,6 +18,7 @@ class SummaryInfo {
$this.TotalTime = [Diagnostics.Stopwatch]::new()
$this.LoopTime = [Diagnostics.Stopwatch]::new()
$this.FeeTime = [Diagnostics.Stopwatch]::new()
$this.FeeCurTime = [Diagnostics.Stopwatch]::new()
$this.RateTime = [Diagnostics.Stopwatch]::new()
$this.RateTimeout = $minutes
}
Expand All @@ -33,6 +35,16 @@ class SummaryInfo {
(" Used RAM: {0,$($elapsed.Length):N1} Mb" -f ([GC]::GetTotalMemory(0)/1mb))
}

[void] FStart() {
$this.FeeCurTime.Start()
$this.FeeTime.Start()
}

[void] FStop() {
$this.FeeCurTime.Reset()
$this.FeeTime.Stop()
}

static [string] Elapsed([TimeSpan] $ts) {
$f = "{1:00}:{2:00}:{3:00}"
if ($ts.Days) { $f = "{0:0} " + $f }
Expand Down
26 changes: 21 additions & 5 deletions MindMiner.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ while ($true)
}
}

# stop benchmark by condition: timeout reached and has result or timeout more 5 and no result
# stop benchmark by condition: timeout reached and has result or timeout more then twice and no result
$ActiveMiners.Values | Where-Object { $_.State -eq [eState]::Running -and $_.Action -eq [eAction]::Benchmark } | ForEach-Object {
$speed = $_.GetSpeed()
if (($_.CurrentTime.Elapsed.TotalSeconds -ge $_.Miner.BenchmarkSeconds -and $speed -gt 0) -or
Expand Down Expand Up @@ -175,15 +175,28 @@ while ($true)

if (!$exit) {
Remove-Variable speed


$FStart = (($AllMiners | Where-Object { $Statistics.GetValue($_.Miner.GetFilename(), $_.Miner.GetKey()) -eq 0 } | Select-Object -First 1) -eq $null) -and
($Summary.TotalTime.Elapsed.TotalSeconds / 100 -gt ($Summary.FeeTime.Elapsed.TotalSeconds + $Config.AverageCurrentHashSpeed / 2))
$FChange = $FStart
if ($FStart -or $Summary.FeeCurTime.IsRunning) {
if ($Summary.FeeCurTime.Elapsed.TotalSeconds -gt $Config.AverageCurrentHashSpeed) {
$FChange = $true
$Summary.FStop()
}
else {
$Summary.FStart()
}
}

# look for run or stop miner
[Config]::ActiveTypes | ForEach-Object {
$type = $_

$allMinersByType = $AllMiners | Where-Object { $_.Miner.Type -eq $type }
$activeMinersByType = $ActiveMiners.Values | Where-Object { $_.Miner.Type -eq $type }

# run for bencmark - exclude failed
# run for bencmark
$run = $allMinersByType | Where-Object { $Statistics.GetValue($_.Miner.GetFilename(), $_.Miner.GetKey()) -eq 0 } | Select-Object -First 1

# nothing benchmarking - get most profitable - exclude failed
Expand All @@ -207,8 +220,8 @@ while ($true)
if (!$ActiveMiners.ContainsKey($miner.GetUniqueKey())) {
$ActiveMiners.Add($miner.GetUniqueKey(), [MinerProcess]::new($miner, $Config))
}
#stop not choosen
$activeMinersByType | Where-Object { $miner.GetUniqueKey() -ne $_.Miner.GetUniqueKey() } | ForEach-Object {
# stop not choosen
$activeMinersByType | Where-Object { $miner.GetUniqueKey() -ne $_.Miner.GetUniqueKey() -or $FChange } | ForEach-Object {
$_.Stop()
}
# run choosen
Expand All @@ -217,6 +230,9 @@ while ($true)
if ($Statistics.GetValue($mi.Miner.GetFilename(), $mi.Miner.GetKey()) -eq 0) {
$mi.Benchmark()
}
elseif ($FStart) {
$mi.Fee()
}
else {
$mi.Start()
}
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ Place `config.txt` file into programm folder with json content
![MindMiner](https://github.com/Quake4/MindMinerPrerequisites/raw/master/RX5804G.png "MindMiner on AMD RX 580 4G")

## Fee
MindMiner has development fee ~~1% and~~ in all benchmarks.
MindMiner has development fee 1% and all benchmarks.

## Thanks
Thanks to aaronsace to the idea but weak implementation.

0 comments on commit 60cd8c5

Please sign in to comment.