Created
February 12, 2024 23:53
-
-
Save Luigi-Pizzolito/385759cd87b70ac0fbf61cf6e4c81b37 to your computer and use it in GitHub Desktop.
Monitor channel buffer size continously to determine optimum capacity.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//! channel capacity monitoring for profiling | |
func monitorChan[T any](ch chan T, name string) { | |
chanMonitorInterval := time.Second | |
for { | |
// if len(ch) == cap(ch) { | |
fmt.Printf("Channel: %s, Size: %d\n", name, len(ch)) | |
// } | |
time.Sleep(chanMonitorInterval) | |
} | |
} | |
//! Call this after creating channel | |
go monitorChan(procFrameQueue1, "channel_from->channel_to") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment