mirror of
https://github.com/bloeys/cogo.git
synced 2025-12-29 08:58:19 +00:00
Print time taken in demo
This commit is contained in:
3
demo.go
3
demo.go
@ -12,11 +12,14 @@ func runDemo() {
|
|||||||
c := cogo.New(test, 0)
|
c := cogo.New(test, 0)
|
||||||
|
|
||||||
ticks := 1
|
ticks := 1
|
||||||
|
start := time.Now()
|
||||||
for done := c.Tick(); !done; done = c.Tick() {
|
for done := c.Tick(); !done; done = c.Tick() {
|
||||||
println("Ticks done:", ticks, "; Output:", c.Out, "\n")
|
println("Ticks done:", ticks, "; Output:", c.Out, "\n")
|
||||||
ticks++
|
ticks++
|
||||||
time.Sleep(1 * time.Millisecond)
|
time.Sleep(1 * time.Millisecond)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
println("Time taken:", time.Since(start).String())
|
||||||
}
|
}
|
||||||
|
|
||||||
func test(c *cogo.Coroutine[int, int]) {
|
func test(c *cogo.Coroutine[int, int]) {
|
||||||
|
|||||||
Reference in New Issue
Block a user