Skip to content

Commit 6fc0f1b

Browse files
authored
Merge pull request #6 from MichaelBell/feature-improve-throughput
Improve throughput
2 parents 522842e + 8e9cce6 commit 6fc0f1b

File tree

7 files changed

+235
-132
lines changed

7 files changed

+235
-132
lines changed

.gitignore

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# Build artifacts
2+
*.o
3+
rieMiner
4+
rieMiner.exe
5+
6+
# Per user configuration
7+
rieMiner.conf
8+
9+
# Other
10+
rieMiner.exe.stackdump
11+
.*.swp

client.h

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,6 @@
1111

1212
class WorkManager;
1313

14-
enum JobType {TYPE_CHECK, TYPE_MOD, TYPE_SIEVE};
15-
#define WORK_INDEXES 64
16-
1714
struct BlockHeader { // Total 1024 bits/128 bytes (256 hex chars)
1815
uint32_t version;
1916
uint8_t previousblockhash[32]; // 256 bits

external/mod_1_4_win.asm

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -120,18 +120,16 @@ PROLOGUE(rie_mod_1s_4p)
120120

121121
mov %rcx, %rdi
122122
mov %rdx, %rsi
123-
mov %r8, %rdx
124-
mov %r9, %rcx
125-
126-
push %rdx
127-
mov %rcx, %r14
128-
mov 8(%rcx), R32(%r11) C B1modb
129-
mov 12(%rcx), R32(%rbx) C B2modb
130-
mov 16(%rcx), R32(%rbp) C B3modb
131-
mov 20(%rcx), R32(%r13) C B4modb
132-
mov 24(%rcx), R32(%r12) C B5modb
133-
134-
mov 28(%rcx), R32(%r8)
123+
124+
push %r8
125+
mov %r9, %r14
126+
mov 8(%r9), R32(%r11) C B1modb
127+
mov 12(%r9), R32(%rbx) C B2modb
128+
mov 16(%r9), R32(%rbp) C B3modb
129+
mov 20(%r9), R32(%r13) C B4modb
130+
mov 24(%r9), R32(%r12) C B5modb
131+
132+
mov 28(%r9), R32(%r8)
135133
and $0x1ffffff, R32(%r8)
136134
jz L(nohi)
137135

main.cpp

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -53,15 +53,17 @@ void WorkManager::submitWork(WorkData wd, uint32_t* nOffset, uint8_t length) {
5353
_clientMutex.unlock();
5454
}
5555

56+
bool WorkManager::getWork(WorkData& wd) {
57+
_clientMutex.lock();
58+
wd = _client->workData();
59+
_clientMutex.unlock();
60+
return wd.height != 0;
61+
}
62+
5663
void WorkManager::minerThread() {
5764
WorkData wd;
5865
while (true) {
59-
bool hasValidWork(false);
60-
_clientMutex.lock();
61-
wd = _client->workData(); // Get generated work data from client
62-
_clientMutex.unlock();
63-
if (wd.height > 0) hasValidWork = true;
64-
if (!hasValidWork) usleep(1000*_workRefresh/2);
66+
if (!getWork(wd)) usleep(1000*_workRefresh/2);
6567
else _miner->process(wd);
6668
}
6769
}
@@ -114,7 +116,7 @@ void WorkManager::manage() {
114116
_stats.updateHeight(_client->workData().height - 1);
115117
std::cout << "-----------------------------------------------------------" << std::endl;
116118
uint32_t startHeight(_client->workData().height);
117-
std::cout << "[0000:00:00] Started mining at block " << startHeight << std::endl;
119+
std::cout << "[0000:00:00] Started mining at block " << startHeight;
118120
_stats.initHeight(startHeight);
119121
_miningStarted = true;
120122
}

main.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -322,6 +322,7 @@ class WorkManager : public std::enable_shared_from_this<WorkManager> {
322322

323323
void init();
324324
void submitWork(WorkData wd, uint32_t* nOffset, uint8_t length);
325+
bool getWork(WorkData& wd);
325326
void manage();
326327
Options options() const {return _options;}
327328
uint32_t height() const {return _stats.height();}

0 commit comments

Comments
 (0)