mirror of
https://github.com/genodelabs/genode.git
synced 2025-01-31 00:24:51 +00:00
net-stat: remove as it is not used and outdated
According to the creator of the net-stat lib, this lib was a mere debugging tool that is not used anymore nor worth the work of updating the it to modern Genode coding paradigms. Also, there exist no tests for the lib.
This commit is contained in:
parent
80ef5fa73c
commit
8844c57254
@ -1,6 +0,0 @@
|
||||
LIBS += net-stat
|
||||
CC_OPT += -DGENODE_NET_STAT
|
||||
|
||||
include $(REP_DIR)/lib/mk/spec/arndale/usb.mk
|
||||
|
||||
CC_CXX_WARN_STRICT =
|
@ -1,6 +0,0 @@
|
||||
LIBS += net-stat
|
||||
CC_OPT += -DGENODE_NET_STAT
|
||||
|
||||
include $(REP_DIR)/lib/mk/spec/odroid_x2/usb.mk
|
||||
|
||||
CC_CXX_WARN_STRICT =
|
@ -1,6 +0,0 @@
|
||||
LIBS += net-stat
|
||||
CC_OPT += -DGENODE_NET_STAT
|
||||
|
||||
include $(REP_DIR)/lib/mk/spec/panda/usb.mk
|
||||
|
||||
CC_CXX_WARN_STRICT =
|
@ -1,19 +0,0 @@
|
||||
/*
|
||||
* \brief Startup USB driver library
|
||||
* \author Sebastian Sumpf
|
||||
* \date 2013-02-20
|
||||
*/
|
||||
|
||||
/*
|
||||
* Copyright (C) 2013-2017 Genode Labs GmbH
|
||||
*
|
||||
* This file is distributed under the terms of the GNU General Public License
|
||||
* version 2.
|
||||
*/
|
||||
|
||||
int main()
|
||||
{
|
||||
extern void start_usb_driver();
|
||||
start_usb_driver();
|
||||
return 0;
|
||||
}
|
@ -1,5 +0,0 @@
|
||||
TARGET = usb_drv_net_stat
|
||||
SRC_CC = main.cc
|
||||
LIBS = usb-stat
|
||||
|
||||
CC_CXX_WARN_STRICT =
|
@ -1,3 +0,0 @@
|
||||
SRC_CC = stat.cc
|
||||
|
||||
vpath %.cc $(REP_DIR)/src/lib/net
|
@ -1,90 +0,0 @@
|
||||
/*
|
||||
* \brief Parse ethernet packets and find magic values to start performance
|
||||
* measurements
|
||||
* \author Alexander Boettcher
|
||||
* \date 2013-03-26
|
||||
*/
|
||||
|
||||
/*
|
||||
* Copyright (C) 2013-2017 Genode Labs GmbH
|
||||
*
|
||||
* This file is part of the Genode OS framework, which is distributed
|
||||
* under the terms of the GNU Affero General Public License version 3.
|
||||
*/
|
||||
|
||||
#include <nic/stat.h>
|
||||
|
||||
#include <net/ipv4.h>
|
||||
#include <net/udp.h>
|
||||
|
||||
namespace Nic {
|
||||
|
||||
enum Measurement::status Measurement::_check(Net::Ethernet_frame * eth,
|
||||
Genode::size_t size)
|
||||
{
|
||||
using namespace Net;
|
||||
|
||||
if (Genode::memcmp(eth->dst().addr, _mac.addr, sizeof(_mac.addr)))
|
||||
return Measurement::UNKNOWN;
|
||||
|
||||
Ipv4_packet *ip = new (eth->data<void>()) Ipv4_packet(size -
|
||||
sizeof(Ethernet_frame));
|
||||
|
||||
if (ip->protocol() != Ipv4_packet::Protocol::UDP)
|
||||
return Measurement::UNKNOWN;
|
||||
|
||||
Udp_packet *udp = new (ip->data<void>()) Udp_packet(size - sizeof(Ethernet_frame)
|
||||
- sizeof(Ipv4_packet));
|
||||
|
||||
Genode::uint8_t magic [] = "Hello world! Genode is greeting.";
|
||||
|
||||
if (Genode::memcmp(udp->data<void>(), magic, sizeof(magic) - 1))
|
||||
return Measurement::FOR_US;
|
||||
return Measurement::IS_MAGIC;
|
||||
}
|
||||
|
||||
void Measurement::data(Net::Ethernet_frame * eth, Genode::size_t size)
|
||||
{
|
||||
|
||||
enum status status = _check(eth, size);
|
||||
|
||||
if (status == UNKNOWN) {
|
||||
_drop.count ++;
|
||||
_drop.size += size;
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
_stat.count ++;
|
||||
_stat.size += size;
|
||||
|
||||
if (status != IS_MAGIC)
|
||||
return;
|
||||
|
||||
using namespace Genode;
|
||||
|
||||
addr_t old = _timestamp;
|
||||
_timestamp = _timer.elapsed_ms();
|
||||
|
||||
unsigned long time_elapsed_ms = _timestamp - old;
|
||||
unsigned long kbits_test = 0;
|
||||
unsigned long kbits_raw = 0;
|
||||
|
||||
if (time_elapsed_ms)
|
||||
kbits_test = _stat.size / time_elapsed_ms * 8;
|
||||
if (time_elapsed_ms)
|
||||
kbits_raw = (_stat.size + _drop.size) / time_elapsed_ms * 8;
|
||||
|
||||
log(kbits_test, " kBit/s (raw ", kbits_raw, " kBit/s), "
|
||||
"runtime ", time_elapsed_ms, " ms");
|
||||
log((unsigned long)(_stat.size / 1024), " kiBytes (+ ",
|
||||
(unsigned long)(_drop.size / 1024), " kiBytes dropped)");
|
||||
log(_stat.count, " packets (+ ", _drop.count, " packets dropped)");
|
||||
log("");
|
||||
|
||||
_stat.size = _stat.count = _drop.size = _drop.count = 0;
|
||||
|
||||
_timestamp = _timer.elapsed_ms();
|
||||
}
|
||||
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user