-
Notifications
You must be signed in to change notification settings - Fork 92
/
Copy pathfactomd.go
53 lines (40 loc) · 1.17 KB
/
factomd.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
// Copyright 2017 Factom Foundation
// Use of this source code is governed by the MIT
// license that can be found in the LICENSE file.
package main
import (
"fmt"
"os"
"reflect"
"runtime"
"time"
"github.com/FactomProject/factomd/common/constants/runstate"
. "github.com/FactomProject/factomd/engine"
)
func main() {
// uncomment StartProfiler() to run the pprof tool (for testing)
// Go Optimizations...
runtime.GOMAXPROCS(runtime.NumCPU()) // TODO: should be *2 to use hyperthreadding? -- clay
fmt.Println("Command Line Arguments:")
for _, v := range os.Args[1:] {
fmt.Printf("\t%s\n", v)
}
params := ParseCmdLine(os.Args[1:])
fmt.Println()
fmt.Println("Parameter:")
s := reflect.ValueOf(params).Elem()
typeOfT := s.Type()
for i := 0; i < s.NumField(); i++ {
f := s.Field(i)
fmt.Printf("%d: %25s %s = %v\n", i,
typeOfT.Field(i).Name, f.Type(), f.Interface())
}
fmt.Println()
sim_Stdin := params.Sim_Stdin
state := Factomd(params, sim_Stdin)
for state.GetRunState() != runstate.Stopped {
time.Sleep(time.Second)
}
fmt.Println("Waiting to Shut Down") // This may not be necessary anymore with the new run state method
time.Sleep(time.Second * 5)
}