mirror of
https://github.com/weaveworks/scope.git
synced 2026-07-28 01:31:17 +00:00
Allow packet capture with effective sample rate 100%
This commit is contained in:
@@ -115,9 +115,6 @@ func main() {
|
||||
}
|
||||
|
||||
if *captureEnabled {
|
||||
if *captureOn > *captureOff {
|
||||
log.Fatalf("-capture.on (%s) must be <= -capture.off (%s)", *captureOn, *captureOff)
|
||||
}
|
||||
for _, iface := range strings.Split(*captureInterfaces, ",") {
|
||||
source, err := sniff.NewSource(iface)
|
||||
if err != nil {
|
||||
|
||||
@@ -64,6 +64,12 @@ func (s *Sniffer) loop(src gopacket.ZeroCopyPacketDataSource, on, off time.Durat
|
||||
done = make(chan struct{}) // when src is finished, we're done too
|
||||
)
|
||||
|
||||
// As a special case, if our off duty cycle is zero, i.e. 100% sample
|
||||
// rate, we simply disable the turn-off signal channel.
|
||||
if off == 0 {
|
||||
turnOff = nil
|
||||
}
|
||||
|
||||
go func() {
|
||||
s.read(src, packets, &process, &total, &count)
|
||||
close(done)
|
||||
|
||||
Reference in New Issue
Block a user