Minor updates to the UI

This commit is contained in:
obscuren
2014-08-23 11:00:15 +02:00
parent 5ac875b097
commit ded013b7a7
3 changed files with 115 additions and 40 deletions

View File

@ -6,6 +6,7 @@ import (
"fmt"
"math/big"
"os"
"runtime"
"strconv"
"strings"
"time"
@ -412,6 +413,7 @@ func (gui *Gui) update() {
peerUpdateTicker := time.NewTicker(5 * time.Second)
generalUpdateTicker := time.NewTicker(1 * time.Second)
statsUpdateTicker := time.NewTicker(5 * time.Second)
state := gui.eth.StateManager().TransState()
@ -488,6 +490,10 @@ func (gui *Gui) update() {
pow := gui.miner.GetPow()
miningLabel.Set("text", "Mining @ "+strconv.FormatInt(pow.GetHashrate(), 10)+"Khash")
}
case <-statsUpdateTicker.C:
gui.setStatsPane()
}
}
}()
@ -507,6 +513,28 @@ func (gui *Gui) update() {
reactor.Subscribe("peerList", peerChan)
}
func (gui *Gui) setStatsPane() {
var memStats runtime.MemStats
runtime.ReadMemStats(&memStats)
statsPane := gui.getObjectByName("statsPane")
statsPane.Set("text", fmt.Sprintf(`###### Ethereal 0.6.4 (%s) #######
CPU: # %d
Goroutines: # %d
CGoCalls: # %d
Alloc: %d
Heap Alloc: %d
CGNext: %x
NumGC: %d
`, runtime.Version(), runtime.NumCPU, runtime.NumGoroutine(), runtime.NumCgoCall(),
memStats.Alloc, memStats.HeapAlloc,
memStats.NextGC, memStats.NumGC,
))
}
func (gui *Gui) CopyToClipboard(data string) {
//clipboard.WriteAll("test")
fmt.Println("COPY currently BUGGED. Here are the contents:\n", data)