This repository has been archived by the owner on May 26, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 28
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add bandwidth-related metrics (for Linux and OSX)
- Loading branch information
1 parent
d3fdb0f
commit 586c623
Showing
4 changed files
with
99 additions
and
0 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
//+build darwin | ||
|
||
package tcp | ||
|
||
import "github.com/mikioh/tcpinfo" | ||
|
||
const ( | ||
hasSegmentCounter = true | ||
hasByteCounter = true | ||
) | ||
|
||
func getSegmentsSent(info *tcpinfo.Info) uint64 { return info.Sys.SegsSent } | ||
func getSegmentsRcvd(info *tcpinfo.Info) uint64 { return info.Sys.SegsReceived } | ||
func getBytesSent(info *tcpinfo.Info) uint64 { return info.Sys.BytesSent } | ||
func getBytesRcvd(info *tcpinfo.Info) uint64 { return info.Sys.BytesReceived } |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
//+build !linux,!darwin | ||
|
||
package tcp | ||
|
||
import "github.com/mikioh/tcpinfo" | ||
|
||
const ( | ||
hasSegmentCounter = false | ||
hasByteCounter = false | ||
) | ||
|
||
func getSegmentsSent(info *tcpinfo.Info) uint64 { return 0 } | ||
func getSegmentsRcvd(info *tcpinfo.Info) uint64 { return 0 } | ||
func getBytesSent(info *tcpinfo.Info) uint64 { return 0 } | ||
func getBytesRcvd(info *tcpinfo.Info) uint64 { return 0 } |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
//+build linux | ||
|
||
package tcp | ||
|
||
import "github.com/mikioh/tcpinfo" | ||
|
||
const ( | ||
hasSegmentCounter = true | ||
hasByteCounter = false | ||
) | ||
|
||
func getSegmentsSent(info *tcpinfo.Info) uint64 { return uint64(info.Sys.SegsOut) } | ||
func getSegmentsRcvd(info *tcpinfo.Info) uint64 { return uint64(info.Sys.SegsIn) } | ||
func getBytesSent(info *tcpinfo.Info) uint64 { return 0 } | ||
func getBytesRcvd(info *tcpinfo.Info) uint64 { return 0 } |