@@ 37,6 37,7 @@ func index() {
cpu := runtime.NumCPU()
fmt.Println("cpu count:", cpu)
+ var start time.Time
for i := 0; i < cpu; i++ {
go func(i int) {
n := 0
@@ 46,14 47,15 @@ func index() {
N++
if rand.Intn(1000) == 7 {
- fmt.Printf("[%d] %d indexed, %d total\n",
- i, n, N)
+ fmt.Printf("[%v] indexed:%d, total:%d\n",
+ time.Now().Sub(start), n, N)
}
}
}(i)
}
fmt.Println("loading data")
+ start = time.Now()
for data.Next() {
var m M
err = data.Scan(&m.T, &m.Login, &m.Text)
@@ 64,7 66,7 @@ func index() {
pipe <- m
if rand.Intn(1000) == 7 {
t := time.Unix(0, m.T).Format(time.RFC822)
- fmt.Printf("[∆] %v\n", t)
+ fmt.Println(t)
}
}