(b *testing.B)
| 262 | } |
| 263 | |
| 264 | func BenchmarkActorConcurrent(b *testing.B) { |
| 265 | system := actor.NewSystem("bench") |
| 266 | defer system.Shutdown() |
| 267 | |
| 268 | counter := &CounterActor{name: "counter"} |
| 269 | pid := system.Spawn(counter, "counter") |
| 270 | |
| 271 | b.ResetTimer() |
| 272 | b.RunParallel(func(pb *testing.PB) { |
| 273 | for pb.Next() { |
| 274 | pid.Tell(&IncrementMsg{Value: 1}) |
| 275 | } |
| 276 | }) |
| 277 | } |
| 278 | |
| 279 | // ============================================================================= |
| 280 | // 高级测试 |