Skip to content

Commit 2d836b7

Browse files
committed
stats submissions
1 parent 2128081 commit 2d836b7

File tree

6 files changed

+50
-17
lines changed

6 files changed

+50
-17
lines changed

config.yaml

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
1-
numeric_id: 12234949781109786614 # numeric ID to emulate
2-
#start_nonce: 0 # start_nonce for emulation, default = rand
3-
secret_phrase: 'sent innocent black neighbor nose cruel surround puff marry around dumb warn' # empty for pool, passphrase for Burst solo
1+
numeric_id: 8877950902124165183 # numeric ID to emulate
2+
#start_nonce: 0 # start_nonce for emulation, default = rand
3+
secret_phrase: '' # empty for pool, passphrase for Burst solo
44
blocktime: 240 # needed for capacity estimate
55

6-
url: 'http://localhost:8125'
6+
url: 'http://gpupool.de:7777/' # bencher stats pool
7+
#url: 'http://localhost:8125' # local wallet
78

89
cpu_threads: 0 # default 0 (=cpu disabled)
910
cpu_task_size: 262144 # default 262144, value in nonces
@@ -17,7 +18,7 @@ get_mining_info_interval: 1000 # default 1000ms
1718
timeout: 3000 # default 3000ms
1819
send_proxy_details: true # default true
1920
#additional_headers: # add/overwrite html headers (optional)
20-
# "AccountKey" : "1234567890"
21+
# "X-MinerAlias" : "JohnnyFFM"
2122

2223
console_log_level: 'info' # default Info, options (off, error, warn, info, debug, trace)
2324
logfile_log_level: 'warn' # default Warn, options (off, error, warn, info, debug, trace)

src/com/client.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -137,12 +137,16 @@ impl Client {
137137
}
138138

139139
/// Get current mining info.
140-
pub fn get_mining_info(&self, capacity: u64, additional_headers: Arc<HashMap<String, String>>) -> impl Future<Item = MiningInfoResponse, Error = FetchError> {
140+
pub fn get_mining_info(&self, capacity: u64, additional_headers: Arc<HashMap<String, String>>, xpu_string : Arc<String>) -> impl Future<Item = MiningInfoResponse, Error = FetchError> {
141141
let mut headers = (*self.headers).clone();
142142
headers.insert(
143143
"X-Capacity",
144144
capacity.to_string().parse().unwrap(),
145145
);
146+
headers.insert(
147+
"X-Xpu",
148+
xpu_string.parse().unwrap(),
149+
);
146150
for (key, value) in &*additional_headers {
147151
let header_name = HeaderName::from_bytes(&key.clone().into_bytes()).unwrap();
148152
headers.insert(header_name, value.parse().unwrap());

src/main.rs

Lines changed: 23 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -104,14 +104,33 @@ fn main() {
104104
&simd_extension
105105
);
106106

107+
let mut cpu_string = format!(
108+
"cpu: {} [using {} of {} cores{}{:?}]",
109+
cpu_name,
110+
cpu_threads,
111+
num_cpus::get(),
112+
if let SimdExtension::None = &simd_extension {
113+
""
114+
} else {
115+
" + "
116+
},
117+
&simd_extension
118+
);
119+
120+
cpu_string.push_str(&", ".to_owned());
121+
122+
#[cfg(not(feature = "opencl"))]
123+
let gpu_string = "".to_owned();
107124
#[cfg(not(feature = "opencl"))]
108-
let gpu_mem_needed = 0u64;
125+
let gpu_mem_needed = 0u64;
109126
#[cfg(feature = "opencl")]
110-
let _gpu_mem_needed = if !cfg_loaded.gpus.is_empty() {
127+
let (_gpu_mem_needed, gpu_string) = if !cfg_loaded.gpus.is_empty() {
111128
gpu_get_info(&cfg_loaded.gpus, false)
112129
} else {
113-
0
130+
(0,"".to_owned())
114131
};
132+
cpu_string.push_str(&gpu_string);
133+
115134
#[cfg(feature = "opencl")]
116135
info!("gpu extensions: OpenCL");
117136

@@ -128,7 +147,7 @@ fn main() {
128147
);
129148

130149
let rt = Builder::new().core_threads(1).build().unwrap();
131-
let m = Miner::new(cfg_loaded, simd_extension, cpu_threads, rt.executor());
150+
let m = Miner::new(cfg_loaded, simd_extension, cpu_threads, rt.executor(), cpu_string);
132151
m.run();
133152
rt.shutdown_on_idle().wait().unwrap();
134153
}

src/miner.rs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,8 @@ pub struct Miner {
3333
blocktime: u64,
3434
gpus: Vec<GpuConfig>,
3535
get_mining_info_interval: u64,
36-
additional_headers: Arc<HashMap<String, String>>
36+
additional_headers: Arc<HashMap<String, String>>,
37+
xpu_string: String,
3738
}
3839

3940
pub struct State {
@@ -111,6 +112,7 @@ impl Miner {
111112
simd_extensions: SimdExtension,
112113
cpu_threads: usize,
113114
executor: TaskExecutor,
115+
xpu_string: String,
114116
) -> Miner {
115117
info!("server: {}", cfg.url);
116118
let additional_headers = Arc::new(cfg.additional_headers);
@@ -136,6 +138,7 @@ impl Miner {
136138
gpus: cfg.gpus,
137139
get_mining_info_interval: max(1000, cfg.get_mining_info_interval),
138140
additional_headers: additional_headers.clone(),
141+
xpu_string,
139142
}
140143
}
141144

@@ -164,6 +167,7 @@ impl Miner {
164167
let inner_tx_rounds = tx_rounds.clone();
165168
let get_mining_info_interval = self.get_mining_info_interval;
166169
let additional_headers = self.additional_headers.clone();
170+
let xpu_string = Arc::new(self.xpu_string);
167171
// run main mining loop on core
168172
self.executor.clone().spawn(
169173
Interval::new_interval(Duration::from_millis(get_mining_info_interval))
@@ -174,7 +178,7 @@ impl Miner {
174178
let capacity = state2.capacity;
175179
drop(state2);
176180
let tx_rounds = inner_tx_rounds.clone();
177-
request_handler.get_mining_info(capacity, additional_headers.clone()).then(move |mining_info| {
181+
request_handler.get_mining_info(capacity, additional_headers.clone(), xpu_string.clone()).then(move |mining_info| {
178182
match mining_info {
179183
Ok(mining_info) => {
180184
let mut state = state.lock().unwrap();

src/ocl.rs

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -193,8 +193,9 @@ fn get_cores(device: core::DeviceId) -> u32 {
193193
}
194194
}
195195

196-
pub fn gpu_get_info(gpus: &[GpuConfig], quiet: bool) -> u64 {
196+
pub fn gpu_get_info(gpus: &[GpuConfig], quiet: bool) -> (u64, String) {
197197
let mut total_mem_needed = 0u64;
198+
let mut gpu_string: String = "".to_owned();
198199
for gpu in gpus.iter() {
199200
let platform_ids = core::get_platform_ids().unwrap();
200201
if gpu.platform_id >= platform_ids.len() {
@@ -249,7 +250,11 @@ pub fn gpu_get_info(gpus: &[GpuConfig], quiet: bool) -> u64 {
249250
println!("Shutting down...");
250251
process::exit(0);
251252
}
252-
253+
gpu_string.push_str(&"gpu(s): ".to_owned());
254+
gpu_string.push_str(&to_string!(core::get_device_info(&device, DeviceInfo::Vendor)));
255+
gpu_string.push_str(&" - ".to_owned());
256+
gpu_string.push_str(&to_string!(core::get_device_info(&device, DeviceInfo::Name)));
257+
gpu_string.push_str(&",".to_owned());
253258
if !quiet {
254259
info!(
255260
"gpu: {} - {} [using {} of {} cores]",
@@ -269,7 +274,7 @@ pub fn gpu_get_info(gpus: &[GpuConfig], quiet: bool) -> u64 {
269274

270275
total_mem_needed += mem_needed as u64 / 2;
271276
}
272-
total_mem_needed
277+
(total_mem_needed, gpu_string)
273278
}
274279

275280
pub fn gpu_init(gpus: &[GpuConfig]) -> Vec<Arc<GpuContext>> {

src/request.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -143,8 +143,8 @@ impl RequestHandler {
143143
executor.spawn(stream);
144144
}
145145

146-
pub fn get_mining_info(&self, capacity: u64, additional_headers: Arc<HashMap<String, String>>) -> impl Future<Item = MiningInfoResponse, Error = FetchError> {
147-
self.client.get_mining_info(capacity, additional_headers)
146+
pub fn get_mining_info(&self, capacity: u64, additional_headers: Arc<HashMap<String, String>>, xpu_string: Arc<String>) -> impl Future<Item = MiningInfoResponse, Error = FetchError> {
147+
self.client.get_mining_info(capacity, additional_headers, xpu_string)
148148
}
149149

150150
pub fn submit_nonce(

0 commit comments

Comments
 (0)