Small tool to get worker hashrates

I figured I would share a small project I wrote today:

I wrote this tool, because I wanted a way to see quickly check the hashrate of my miners. The grin server UI does not show hashrates. At first I tried to add hashrates to the server UI, but realized it would be a complicated set of changes & the complexity wasn’t justified IMO. Instead, I decided to write a small standalone tool to parse the server logs and compute hashrates from there.

Here is an example output:

$ ./target/release/grinworkers -t 1440
Parsing ~/.grin/main/grin-server.log
worker1: 1.40 G/s (2876 shares in 1439 min)
worker2: 1.19 G/s (2438 shares in 1439 min)

Maybe someone else will find this useful too. Cheers.

12 Likes

Hello Cliik! I tried to install your tool but I’m getting errors E0658 and E0554 while compiling it.
error[E0658]: let expressions in this position are unstable
→ src/main.rs:101:8
|
101 | if let Some(d) = avg_duration && log_duration <= d {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= note: see issue #53667 https://github.com/rust-lang/rust/issues/53667 for more information

error[E0554]: #![feature] may not be used on the stable release channel
→ src/main.rs:1:12
|
1 | #![feature(iter_intersperse)]
| ^^^^^^^^^^^^^^^^
can you help to figure out reason for that two errors?

Hi @mezonines, thanks for trying it out. Sorry you hit a bug so quickly! I typically develop with the “nightly” toolchain, so I didn’t catch that I had done some things that aren’t compatible with the “stable” toolchain. I just pushed a commit to fix the issue. You should be able to pull the latest code & rebuild.

Happy hashing :slight_smile:

Hello Cliik. Thanks for the fix, its working now and I can see workers and their hashrate for defined time.
However, its showing only part of them. Is there any limitation on number of workers that can be displayed? Also, is it possible to sum up number of connected miners and their hashrate and show a line with total hash and miner count?

1 Like

Hi @mezonines the tool just parses info available in your logs. If your workers are submitting shares, then they should be in the logs, and should be picked up by this tool. It could certainly have more bugs though.

If you want to share your logfile, I can debug a bit and see if there’s some condition the tool doesn’t like. Of course, scrub your IP address and any other identifying information before sharing the logs!