(bytes int)
| 28 | } |
| 29 | |
| 30 | func (bt *Base[T, F]) ComputeBPS(bytes int) { |
| 31 | bt.bytes += bytes |
| 32 | bt.frames++ |
| 33 | if elapse := time.Since(bt.ts).Seconds(); elapse > 1 { |
| 34 | bt.BPS = int(float64(bt.bytes) / elapse) |
| 35 | bt.FPS = int(float64(bt.frames) / elapse) |
| 36 | bt.Drops = int(float64(bt.DropCount) / elapse) |
| 37 | bt.bytes = 0 |
| 38 | bt.frames = 0 |
| 39 | bt.DropCount = 0 |
| 40 | bt.ts = time.Now() |
| 41 | } |
| 42 | } |
| 43 | |
| 44 | func (bt *Base[T, F]) GetName() string { |
| 45 | return bt.Name |