Java Code Examples for oshi.hardware.NetworkIF#getBytesSent()
The following examples show how to use
oshi.hardware.NetworkIF#getBytesSent() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: SystemResourcesCounter.java From Flink-CEPplus with Apache License 2.0 | 5 votes |
private void calculateNetworkUsage(NetworkIF[] networkIFs) { checkState(networkIFs.length == receiveRatePerInterface.length()); for (int i = 0; i < networkIFs.length; i++) { NetworkIF networkIF = networkIFs[i]; networkIF.updateNetworkStats(); receiveRatePerInterface.set(i, (networkIF.getBytesRecv() - bytesReceivedPerInterface[i]) * 1000 / probeIntervalMs); sendRatePerInterface.set(i, (networkIF.getBytesSent() - bytesSentPerInterface[i]) * 1000 / probeIntervalMs); bytesReceivedPerInterface[i] = networkIF.getBytesRecv(); bytesSentPerInterface[i] = networkIF.getBytesSent(); } }
Example 2
Source File: SystemResourcesCounter.java From flink with Apache License 2.0 | 5 votes |
private void calculateNetworkUsage(NetworkIF[] networkIFs) { checkState(networkIFs.length == receiveRatePerInterface.length()); for (int i = 0; i < networkIFs.length; i++) { NetworkIF networkIF = networkIFs[i]; networkIF.updateNetworkStats(); receiveRatePerInterface.set(i, (networkIF.getBytesRecv() - bytesReceivedPerInterface[i]) * 1000 / probeIntervalMs); sendRatePerInterface.set(i, (networkIF.getBytesSent() - bytesSentPerInterface[i]) * 1000 / probeIntervalMs); bytesReceivedPerInterface[i] = networkIF.getBytesRecv(); bytesSentPerInterface[i] = networkIF.getBytesSent(); } }
Example 3
Source File: NetworkStatistics.java From garmadon with Apache License 2.0 | 5 votes |
NetworkStatistics() { super(NETWORK_HEADER); for (NetworkIF nic : new SystemInfo().getHardware().getNetworkIFs()) { if (nic.getBytesSent() == 0 && nic.getBytesRecv() == 0) { // nothing happens on this nic since boot continue; } nics.add(new NicInfo(nic)); } }
Example 4
Source File: NetworkStatistics.java From garmadon with Apache License 2.0 | 5 votes |
NicInfo(NetworkIF nic) { this.nic = nic; this.recvProp = nic.getName() + NETWORK_RECV_SUFFIX; this.sentProp = nic.getName() + NETWORK_SENT_SUFFIX; this.pktRecvProp = nic.getName() + NETWORK_PKT_RECV_SUFFIX; this.pktSentProp = nic.getName() + NETWORK_PKT_SENT_SUFFIX; this.errInProp = nic.getName() + NETWORK_ERRORS_IN_SUFFIX; this.errOutProp = nic.getName() + NETWORK_ERRORS_OUT_SUFFIX; this.previousRx = nic.getBytesRecv(); this.previousTx = nic.getBytesSent(); this.previousPktRx = nic.getPacketsRecv(); this.previousPktTx = nic.getPacketsSent(); this.previousErrIn = nic.getInErrors(); this.previousErrOut = nic.getOutErrors(); }
Example 5
Source File: NetworkUtilizationSampler.java From kieker with Apache License 2.0 | 5 votes |
private NetworkStatistic getCurrentNetworkStatistic(final ITimeSource timesource, final NetworkIF networkIF) throws SigarException { final long currentTimestamp = timesource.getTime(); // final NetInterfaceStat interfaceStat = // this.sigar.getNetInterfaceStat(interfaceName); final long speed = networkIF.getSpeed(); final long txBytes = networkIF.getBytesSent(); // final long txCarrier = interfaceStat.getTxCarrier(); final long txCarrier = 0; // final long txCollisions = interfaceStat.getTxCollisions(); final long txCollisions = 0; // final long txDropped = interfaceStat.getTxDropped(); final long txDropped = 0; final long txErrors = networkIF.getOutErrors(); // final long txOverruns = interfaceStat.getTxOverruns(); final long txOverruns = 0; final long txPackets = networkIF.getPacketsSent(); final long rxBytes = networkIF.getBytesRecv(); // final long rxDropped = interfaceStat.getRxDropped(); final long rxDropped = 0; final long rxErrors = networkIF.getInErrors(); // final long rxFrame = interfaceStat.getRxFrame(); final long rxFrame = 0; // final long rxOverruns = interfaceStat.getRxOverruns(); final long rxOverruns = 0; final long rxPackets = networkIF.getPacketsRecv(); return new NetworkStatistic(currentTimestamp, speed, txBytes, txCarrier, txCollisions, txDropped, txErrors, txOverruns, txPackets, rxBytes, rxDropped, rxErrors, rxFrame, rxOverruns, rxPackets); }
Example 6
Source File: SystemResourcesCounter.java From flink with Apache License 2.0 | 5 votes |
private void calculateNetworkUsage(NetworkIF[] networkIFs) { checkState(networkIFs.length == receiveRatePerInterface.length()); for (int i = 0; i < networkIFs.length; i++) { NetworkIF networkIF = networkIFs[i]; networkIF.updateNetworkStats(); receiveRatePerInterface.set(i, (networkIF.getBytesRecv() - bytesReceivedPerInterface[i]) * 1000 / probeIntervalMs); sendRatePerInterface.set(i, (networkIF.getBytesSent() - bytesSentPerInterface[i]) * 1000 / probeIntervalMs); bytesReceivedPerInterface[i] = networkIF.getBytesRecv(); bytesSentPerInterface[i] = networkIF.getBytesSent(); } }