nic_dump: use Duration instead of unsigned

Ref #2490
This commit is contained in:
Martin Stein 2017-09-13 12:44:27 +02:00 committed by Christian Helmuth
parent 97b1a22a8a
commit 3f269b773d
7 changed files with 25 additions and 20 deletions

View File

@ -60,7 +60,7 @@ Net::Session_component::Session_component(Allocator &alloc,
size_t const rx_buf_size,
Xml_node config,
Timer::Connection &timer,
unsigned &curr_time,
Duration &curr_time,
Env &env)
:
Session_component_base(alloc, amount, env.ram(), tx_buf_size, rx_buf_size),
@ -109,7 +109,7 @@ Net::Root::Root(Env &env,
Allocator &alloc,
Xml_node config,
Timer::Connection &timer,
unsigned &curr_time)
Duration &curr_time)
:
Root_component<Session_component, Genode::Single_client>(&env.ep().rpc_ep(),
&alloc),

View File

@ -96,7 +96,7 @@ class Net::Session_component : public Session_component_base,
Genode::size_t const rx_buf_size,
Genode::Xml_node config,
Timer::Connection &timer,
unsigned &curr_time,
Genode::Duration &curr_time,
Genode::Env &env);
@ -106,7 +106,8 @@ class Net::Session_component : public Session_component_base,
Mac_address mac_address() { return _uplink.mac_address(); }
bool link_state() { return _uplink.link_state(); }
void link_state_sigh(Genode::Signal_context_capability sigh) { _link_state_sigh = sigh; }
void link_state_sigh(Genode::Signal_context_capability sigh) {
_link_state_sigh = sigh; }
};
@ -116,9 +117,9 @@ class Net::Root : public Genode::Root_component<Session_component,
private:
Genode::Env &_env;
Genode::Xml_node _config;
Genode::Xml_node _config;
Timer::Connection &_timer;
unsigned &_curr_time;
Genode::Duration &_curr_time;
/********************
@ -133,7 +134,7 @@ class Net::Root : public Genode::Root_component<Session_component,
Genode::Allocator &alloc,
Genode::Xml_node config,
Timer::Connection &timer,
unsigned &curr_time);
Genode::Duration &curr_time);
};
#endif /* _COMPONENT_H_ */

View File

@ -29,10 +29,14 @@ void Interface::_handle_eth(void *const eth_base,
Ethernet_frame &eth = *new (eth_base) Ethernet_frame(eth_size);
Interface &remote = _remote.deref();
if (_log_time) {
unsigned new_time = _timer.curr_time().trunc_to_plain_us().value / 1000;
Genode::Duration const new_time = _timer.curr_time();
unsigned long const new_time_ms = new_time.trunc_to_plain_us().value / 1000;
unsigned long const old_time_ms = _curr_time.trunc_to_plain_us().value / 1000;
log("\033[33m(", remote._label, " <- ", _label, ")\033[0m ", eth,
" \033[33mtime ", new_time, " (", new_time - _curr_time,
")\033[0m");
" \033[33mtime ", new_time_ms, " ms (Δ ",
new_time_ms - old_time_ms, " ms)\033[0m");
_curr_time = new_time;
} else {
log("\033[33m(", remote._label, " <- ", _label, ")\033[0m ", eth);
@ -89,7 +93,7 @@ void Interface::_ready_to_ack()
Interface::Interface(Entrypoint &ep,
Interface_label label,
Timer::Connection &timer,
unsigned &curr_time,
Duration &curr_time,
bool log_time,
Allocator &alloc)
:

View File

@ -50,7 +50,7 @@ class Net::Interface
Pointer<Interface> _remote;
Interface_label _label;
Timer::Connection &_timer;
unsigned &_curr_time;
Genode::Duration &_curr_time;
bool _log_time;
void _send(Ethernet_frame &eth, Genode::size_t const eth_size);
@ -78,7 +78,7 @@ class Net::Interface
Interface(Genode::Entrypoint &ep,
Interface_label label,
Timer::Connection &timer,
unsigned &curr_time,
Genode::Duration &curr_time,
bool log_time,
Genode::Allocator &alloc);

View File

@ -28,11 +28,11 @@ class Main
{
private:
Genode::Attached_rom_dataspace _config;
Timer::Connection _timer;
unsigned _curr_time { 0 };
Genode::Heap _heap;
Net::Root _root;
Attached_rom_dataspace _config;
Timer::Connection _timer;
Duration _curr_time { Microseconds(0UL) };
Heap _heap;
Net::Root _root;
public:

View File

@ -25,7 +25,7 @@ using namespace Genode;
Net::Uplink::Uplink(Env &env,
Xml_node config,
Timer::Connection &timer,
unsigned &curr_time,
Duration &curr_time,
Allocator &alloc)
:
Nic::Packet_allocator(&alloc),

View File

@ -47,7 +47,7 @@ class Net::Uplink : public Nic::Packet_allocator,
Uplink(Genode::Env &env,
Genode::Xml_node config,
Timer::Connection &timer,
unsigned &curr_time,
Genode::Duration &curr_time,
Genode::Allocator &alloc);
};