mirror of
https://github.com/status-im/simulation.git
synced 2025-02-22 20:08:07 +00:00
Refactor export
This commit is contained in:
parent
a17b394dff
commit
86d69a950f
@ -12,6 +12,7 @@ import (
|
||||
"github.com/status-im/simulator/simulation"
|
||||
"github.com/status-im/simulator/simulation/naivep2p"
|
||||
"github.com/status-im/simulator/simulation/whisperv6"
|
||||
"github.com/status-im/simulator/stats"
|
||||
)
|
||||
|
||||
func main() {
|
||||
@ -55,8 +56,13 @@ func main() {
|
||||
|
||||
// Start simulation by sending single message
|
||||
log.Printf("Starting message sending %s simulation for graph with %d nodes...", *simType, len(data.Nodes()))
|
||||
sendData := sim.SendMessage(0, *ttl)
|
||||
err = json.NewEncoder(fd).Encode(sendData)
|
||||
plog := sim.SendMessage(0, *ttl)
|
||||
|
||||
// stats
|
||||
ss := stats.Analyze(data, plog)
|
||||
ss.PrintVerbose()
|
||||
|
||||
err = json.NewEncoder(fd).Encode(plog)
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
|
@ -62,7 +62,6 @@ func NewSimulator(data *graph.Graph) *Simulator {
|
||||
}
|
||||
// it's important to init whisper service here, as it
|
||||
// be initialized for each peer
|
||||
log.Println("Generating new whisper: ", node.ID())
|
||||
service := whisper.New(cfg)
|
||||
whispers[node.ID()] = service
|
||||
}
|
||||
@ -100,7 +99,6 @@ func NewSimulator(data *graph.Graph) *Simulator {
|
||||
case event := <-events:
|
||||
if event.Type == simulations.EventTypeConn {
|
||||
if event.Conn.Up {
|
||||
fmt.Println("Got connection", event)
|
||||
connected++
|
||||
}
|
||||
}
|
||||
@ -245,7 +243,6 @@ func (s *Simulator) LogEntries2PropagationLog(entries []*LogEntry) *simulation.L
|
||||
ret.Timestamps = append(ret.Timestamps, int(ts))
|
||||
ret.Indices = append(ret.Indices, links)
|
||||
ret.Nodes = append(ret.Nodes, tsnodes[ts])
|
||||
fmt.Println("Adding", ts*time.Millisecond, int(ts), links, tsnodes[ts])
|
||||
}
|
||||
|
||||
return ret
|
||||
|
Loading…
x
Reference in New Issue
Block a user